I have a workbook that will be used by multiple users on both PC and Mac.
The objective is to produce a customer quote that can either be printed and e-mailed as a pdf attachment.
The workbook has two worksheets - "Input" and "Quote". All input field are on the Input Sheet and the actual quote is on the Quote sheet which is hidden.
My print macro works OK but my save macro does not. The filename that the pdf is to be saved under is generated from the customers name (an input field) together with the date and is in a cell named "File_Name". The file is to be saved on the user's desktop.
Thanks in anticipation. ..Rick
This is the macro I have.
Sub Quote_Save()
'
' Quote_Save Macro
' Save pdf invoice
'
' Keyboard Shortcut: Option+Cmd+Shift+B
'
Dim DTAddress As String
Dim FileName As String
Dim FullyQualifiedFileName As String
'Unhide and select Quote sheet
Sheets("Input").Select
Sheets("Quote").Visible = True
Sheets("Quote").Select
'Get the path to the User's Desktop
DTAddress = CreateObject("WScript.Shell").SpecialFolders("Desktop") & Application.PathSeparator
'File Name
MyName = Range("File_Name").Value
'Build the fully-qualified Workbook "save" path
FullyQualifiedFileName = DTAddress & MyName
'Switch Off all Application alerts before saving (in case the file already exists etc.)
Application.DisplayAlerts = False
'Save the current active sheet as a PDF file to the user's Desktop
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, FileName:=MyName, _
Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=False
'Switch all Application alerts back on before exiting
Application.DisplayAlerts = True
End Sub
Bookmarks