saltire1963
Board Regular
- Joined
- Aug 11, 2014
- Messages
- 69
I have a workbook that is used by multiple people and I would like for them to be able to save the ActiveSheet as a PDF to their own desktop. Specifically, I do not need what is in the first 8 Rows and therefore the PDF should include only what is in Rows 9 on down.
The line of code I am trying to use is:
Sfile = Application.GetSaveAsFilename _
(InitialFileName:=spath, _
FileFilter:="PDF Files (*.pdf), *.pdf", _
Title:="Select Folder and File name to save")
If Sfile = "false" Then
MsgBox ("Please Choose A File Name")
Exit Sub
End If
ws.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:=Environ("USERPROFILE") & "\Desktop" & "Reports - " & Range("A1"), _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=True
Exit Sub
but this does not work, it gives an error "Run Time Error '1004' Document not saved. The document may be open, or an error may have been encountered when saving." Is it something to do with saving to the USERPROFILE? Can someone show me how to ignore the first 8 Rows when saving to PDF? Thanks in advance
The line of code I am trying to use is:
Sfile = Application.GetSaveAsFilename _
(InitialFileName:=spath, _
FileFilter:="PDF Files (*.pdf), *.pdf", _
Title:="Select Folder and File name to save")
If Sfile = "false" Then
MsgBox ("Please Choose A File Name")
Exit Sub
End If
ws.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:=Environ("USERPROFILE") & "\Desktop" & "Reports - " & Range("A1"), _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=True
Exit Sub
but this does not work, it gives an error "Run Time Error '1004' Document not saved. The document may be open, or an error may have been encountered when saving." Is it something to do with saving to the USERPROFILE? Can someone show me how to ignore the first 8 Rows when saving to PDF? Thanks in advance