Try This..
Sub SaveActivesheet()
Dim strPath As String
strPath = "C:\Documents and Settings\carl.walker\My Documents\"
Dim strFile As String
With Sheet2
'check that Account Details are present (customer's name)'
If .Range("B16").Value = "" Then
MsgBox "Please enter Account Details by using the ADD ACCOUNT Userform provided. ", _
vbExclamation, "Missing Account"
'check that Date is present'
ElseIf .Range("H10").Value = "" Then
MsgBox "Please enter a date. ", _
vbExclamation, "Missing Date"
'check that a Quotation or Invoice number is present '
ElseIf .Range("H8").Value = "" Then
MsgBox "Please enter a Quotation or Invoice number. ", _
vbExclamation, "Missing Quotation or Invoice number"
Else
Select Case .Range("H8")
Case "Q", "q"
strPath = strPath & "Quotations\"
Case "I", "i"
strPath = strPath & "Invoice\"
Case Else
strPath = strPath & "Reports\"
End Select
strFile = .Range("B16").Value & " " & .Range("H10").Value & " " & .Range("H8").Value
.Copy 'Copy sheet2 to a new workbook
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
strPath & strFile & ".pdf", Quality:= _
xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _
OpenAfterPublish:=False
MsgBox "This has now been converted to PDF and has been saved in the Quotations and Invoices folder. ", _
vbExclamation, "Successfully Saved"
End If
End With
End Sub
Bookmarks