ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,738
- Office Version
- 2007
- Platform
- Windows
I am using the supplied code below.
When i run the code i now see the message shown as per screen shot supplied.
The pdf is saved & i see no other messages or errors so not sure why this message is being shown.
Adobe Reader is used.
I go to the path as mentioned & the saved pdf is there & i am able to open it no problem.
Anybody have info on this please or do you see an error in the code.
Thanks
When i run the code i now see the message shown as per screen shot supplied.
The pdf is saved & i see no other messages or errors so not sure why this message is being shown.
Adobe Reader is used.
I go to the path as mentioned & the saved pdf is there & i am able to open it no problem.
Anybody have info on this please or do you see an error in the code.
Thanks
Rich (BB code):
Private Sub CommandButton1_Click()
Dim sPath As String
Dim strFileName As String
Dim sh As Worksheet
If TextBox1 = "" Then
MsgBox "YOU DID NOT ENTER A CUSTOMERS NAME", vbCritical, "NO NAME ENTERED ON SHEET"
TextBox1.SetFocus
Exit Sub
End If
With ThisWorkbook.Worksheets("PRINT LABELS")
.Range("B3") = Me.TextBox1.Text ' ENTERS CUSTOMERS NAME TO WORKSHEET
.Range("E3") = Format(DateSerial(CLng(Me.cboYear.Value), Me.cboMonth.ListIndex + 1, Me.cboDay.Value), "long date")
End With
Unload PrinterForm
With ActiveSheet
If .Range("AB1") = "" Then
MsgBox "NO CODE SHOWN TO GENERATE PDF", vbCritical, "NO CODE ON SHEET TO CREATE PDF"
Exit Sub
End If
strFileName = "C:\Users\Ian\Desktop\REMOTES ETC\DISCO II CODE\DISCO II PDF\" & .Range("B3").Value & " " & Format(.Range("E3").Value, "dd-mm-yyyy") & ".pdf"
.Range("A1:K23").ExportAsFixedFormat Type:=xlTypePDF, Filename:=strFileName, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False
MsgBox "PDF HAS NOW BEEN GENERATED", vbInformation + vbOKOnly, "GENERATE PDF FILE MESSAGE"
End With
sPath = "C:\Users\Ian\Desktop\REMOTES ETC\DISCO II CODE\DISCO II PDF\"
strFileName = sPath & Range("B3").Value & " " & Format(Range("E3").Value, "dd-mm-yyyy") & ".pdf"
If Dir(strFileName) <> vbNullString Then
ActiveWorkbook.FollowHyperlink strFileName
Else
MsgBox ("not found")
End If
End Sub