I am using an ActiveX button to execute the printing of one sheet from another, this is working. But I am also am trying to save the second sheet as a PDF based on a cell value in the first worksheet, in the same code.
Here is the code:
Private Sub CommandButton1_Click()
'Print only "Cal Sheet"
Sheets("Cal Sheet").PrintOut
Dim StrFilename As String
Dim rngRange As Range
Set rngRange = Worksheets("Cal Sheet").Range("C13")
StrFilename = rngRange.Value
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, FileName:="S:\Calibration Bench\CS20\Bencch Data\S-Series" & StrFilename & ".pdf", Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
Sheets("Cal Sheet").Select
End Sub
the print function works, but the save function saves the wrong sheet and doesn't give the name from the data in C13.
any help would be greatly appreciated - thanks!
Here is the code:
Private Sub CommandButton1_Click()
'Print only "Cal Sheet"
Sheets("Cal Sheet").PrintOut
Dim StrFilename As String
Dim rngRange As Range
Set rngRange = Worksheets("Cal Sheet").Range("C13")
StrFilename = rngRange.Value
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, FileName:="S:\Calibration Bench\CS20\Bencch Data\S-Series" & StrFilename & ".pdf", Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
Sheets("Cal Sheet").Select
End Sub
the print function works, but the save function saves the wrong sheet and doesn't give the name from the data in C13.
any help would be greatly appreciated - thanks!