Results 1 to 18 of 18

Export to PDF error

Threaded View

  1. #1
    Registered User
    Join Date
    09-06-2016
    Location
    United Kingdom
    MS-Off Ver
    2013
    Posts
    8

    Export to PDF error

    Hi all,

    First time post here. Moderately new to VBA and still trying to find my feet.

    I am trying to set up up some code to export my active sheet to a PDF, but i keep getting the following message.

    Capture.JPG

    I can say for sure that there file does not already exist and it is not already open. Below is the code I am trying to get to work.

    Private Sub PrintButton_Click()
    Dim i As Long
    
    For i = 0 To Me.SelectedAthletes.ListCount - 1
        ActiveSheet.Range("E6") = Me.SelectedAthletes.List(i)
        Application.Calculate
    
        If Me.ProgramsList.ListIndex = 0 Then
            ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
        "C:\Test666.pdf", Quality:=xlQualityStandard, IncludeDocProperties:=True, _
         IgnorePrintAreas:=False, OpenAfterPublish:=True
        End If
        
        If Me.ProgramsList.ListIndex = 1 Then
          ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
        "C:\Test666.pdf", Quality:=xlQualityStandard, IncludeDocProperties:=True, _
         IgnorePrintAreas:=False, OpenAfterPublish:=True
        End If
        
        If Me.ProgramsList.ListIndex = 2 Then
         ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
        "C:\Test666.pdf", Quality:=xlQualityStandard, IncludeDocProperties:=True, _
         IgnorePrintAreas:=False, OpenAfterPublish:=True
        End If
    
    Next i
    
    End Sub
    I would apprichiate any help or feedback.

    Thanks

    Wheeler
    Last edited by WheelerWarrior; 09-06-2016 at 04:56 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] ActiveSheet will not export to PDF - runtime error 5
    By physicsgal in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 01-28-2016, 03:37 PM
  2. Pivot Table Export Run-Time Error
    By HangMan in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-05-2015, 07:19 AM
  3. Error when try to export Excel data to Access
    By Nelliebeanz in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-24-2014, 09:02 AM
  4. Save\export specific worksheet error
    By SarahPintal in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 01-23-2010, 05:12 PM
  5. Automation Error when trying to export
    By maximus73 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-14-2007, 01:14 PM
  6. [SOLVED] Export to Tab Delimited Text Error
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-24-2006, 11:25 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1