Hi,
I have used following code to save file in PDF to my desktop. ( this is achieved it by assigning macro to a 'Form' button)
But I now want to save it at other location than desktop such as ...... X:\SP\CA\Mar in PDF format with file name as per data in row 9D:9G ( basically 9D:9G will have date , name etc).
I also want now this to be attached as PDF document to a specified email address.
Can this be done? Please help.
Current code is as follows:
I have used following code to save file in PDF to my desktop. ( this is achieved it by assigning macro to a 'Form' button)
But I now want to save it at other location than desktop such as ...... X:\SP\CA\Mar in PDF format with file name as per data in row 9D:9G ( basically 9D:9G will have date , name etc).
I also want now this to be attached as PDF document to a specified email address.
Can this be done? Please help.
Current code is as follows:
Code:
Private Sub CommandButton1_Click()
Sub exportaspdf()
Dim desktoploc As String
Dim filename As String
Dim mypath As String
desktoploc = CreateObject("WScript.Shell").SpecialFolders("Desktop")
filename = ThisWorkbook.Name
mypath = desktoploc & "\" & filename
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, filename:=mypath, _
Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=True
End Sub