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
Bookmarks