Mr_Ragweed2
Board Regular
- Joined
- Nov 11, 2022
- Messages
- 145
- Office Version
- 365
- Platform
- Windows
Hello all.
I am trying to save one worksheet from a workbook of many sheets as a pdf to a different destination. I found a code in this forum that works according to the thread. I will post it here:
The problem is i am getting an error saying "Document not saved. The document may be open, or an error may have been encountered when saving."
The document is definitely open. I am executing the code from a userform button.
Do i need to save to a new workbook first?
I am trying to save one worksheet from a workbook of many sheets as a pdf to a different destination. I found a code in this forum that works according to the thread. I will post it here:
VBA Code:
Dim Path As String
Dim SaveAsStr As String
Path = Sheets("Combined data").Range("D1").Value
SaveAsStr = "https://blah blah.sharepoint.com/:f:/r/teams/nunya/Shared%20Documents/General/Sales%20Apps/Seed%20Orders?csf=1&web=1&e=xW6Z7s"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, _
Filename:=SaveAsStr & ".pdf", _
OpenAfterPublish:=False
The problem is i am getting an error saying "Document not saved. The document may be open, or an error may have been encountered when saving."
The document is definitely open. I am executing the code from a userform button.
Do i need to save to a new workbook first?