ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,235
- Office Version
- 2007
- Platform
- Windows
Hi,
I am currently using the code below to generate a pdf & works fine.
On my worksheet i have a values in the cells shown & this is how i would like the pdf to be named.
Currently the code specifies ("E5") cell only so the pdf is saved / named as A.pdf
I have changed ("E5") to ("E5;J5") hoping to save / name the file as EFGHIL.pdf but then i see the RTE 13
Example of values in cells
E5 A
F5 B
G5 C
H5 D
I5 E
J5 F
Can you advise what is incorrect Thanks
I am currently using the code below to generate a pdf & works fine.
On my worksheet i have a values in the cells shown & this is how i would like the pdf to be named.
Currently the code specifies ("E5") cell only so the pdf is saved / named as A.pdf
I have changed ("E5") to ("E5;J5") hoping to save / name the file as EFGHIL.pdf but then i see the RTE 13
Example of values in cells
E5 A
F5 B
G5 C
H5 D
I5 E
J5 F
Can you advise what is incorrect Thanks
Rich (BB code):
Private Sub EbayPdf_Click()
Dim sPath As String, strFileName As String
strFileName = "C:\Users\Ian\Desktop\REMOTES ETC\DISCO II CODE\EBAY PDF\" & Range("E5").Value & ".pdf"
With ActiveSheet
If Range("E5") = "" Then
MsgBox "NO CODE SHOWN TO GENERATE PDF", vbCritical, "NO CODE ON SHEET TO CREATE PDF"
Exit Sub
End If
.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\DR\DR SCREEN SHOT PDF\"
strFileName = sPath & Range("E5").Value & ".pdf"
If Dir(strFileName) <> vbNullString Then
ActiveWorkbook.FollowHyperlink strFileName
End If
End Sub