Hi All,
I need merge two bits of code to:
1). Save the Active sheet to a certain file whilst using data from B16 and F10 to save as its file name.
2). Save as PDF.
The first bit of code works perfectly, but I just need it to save as a PDF. I have pasted the codes below to look at, and if anyone could help out it would be much appreciated...Thanks in advance. Carl
Sub SaveActivesheet()
Const strPath As String = "C:\Documents and Settings\carl.walker\My Documents\Reports\"
Dim strFile As String
With Sheet2
'check for Account Details'
If .Range("B16").Value = "" Or .Range("F10").Value = "" Then
MsgBox "Please enter Account Details by using the Add Account Details Userform provided. ", _
vbExclamation, "Missing Account"
Else
strFile = .Range("B16").Value & " " & .Range("F10").Value & ".xlsx"
.Copy 'Copy sheet2 to a new workbook
ActiveSheet.SaveAs Filename:=strPath & strFile 'Save the new workbook
End If
End With
End Sub
Sub SavePDFMacro()
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"C:\Documents and Settings\carl.walker\My Documents\Reports", Quality:= _
xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _
OpenAfterPublish:=True
End Sub
Regards
Carl
Bookmarks