ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,699
- Office Version
- 2007
- Platform
- Windows
Hi,
I use the code below & works fine.
Now i wish to use the same code on another worksheet BUT on this sheet i use the Set Print Area
The are thatonly needs to be saved is A1:K23
Rows after K23 have values in etc BUT i dont want them on the saved pdf sheet
Please advise how i can continue
Thanks
I use the code below & works fine.
Now i wish to use the same code on another worksheet BUT on this sheet i use the Set Print Area
The are thatonly needs to be saved is A1:K23
Rows after K23 have values in etc BUT i dont want them on the saved pdf sheet
Please advise how i can continue
Thanks
Rich (BB code):
Private Sub CommandButton1_Click()
ThisWorkbook.Worksheets("PRINT LABELS").Range("B3") = Me.TextBox1.Text ' ENTERS CUSTOMERS NAME TO WORKSHEET
ThisWorkbook.Worksheets("PRINT LABELS").Range("A3") = Me.TextBox2.Text ' ENTERS PCB NUMBER TO WORKSHEET
Unload GenerateForm
Dim sPath As String, strFileName As String
strFileName = "C:\Users\Ian\Desktop\REMOTES ETC\DISCO II CODE\DISCO II PDF\" & Range("B3").Value & " " & Range("A3").Value & ".pdf"
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
.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\EBAY PDF\"
strFileName = sPath & Range("AB1").Value & ".pdf"
If Dir(strFileName) <> vbNullString Then
ActiveWorkbook.FollowHyperlink strFileName
End If
End Sub