willisjk545
New Member
- Joined
- Jun 9, 2017
- Messages
- 1
I have a button that uses the following code to print the information in the range of cells to a PDF:
This worked until a couple days ago and now it gives me the following error:
"runtime error 1004: Document not saved. The file may be open, or an error may have been encountered when saving"
I attempt to debug and after it steps over the above code I get the following:
"Run-time error '1004':
Application-defined or object-defined error"
I have shared this with other people and it works for a short time on their computers then gives them the same issue. I had not changed any library or directory information, I then tried to save to desktop and reload but issue remains.
Any help would be appreciated.
Code:
Private Sub CommandButton1_Click()ActiveWorkbook.Worksheets("Sheet1").Range("L2:L35").ExportAsFixedFormat Type:=xlTypePDF, _
Filename:=Filename, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
OpenAfterPublish:=True
End Sub
This worked until a couple days ago and now it gives me the following error:
"runtime error 1004: Document not saved. The file may be open, or an error may have been encountered when saving"
I attempt to debug and after it steps over the above code I get the following:
"Run-time error '1004':
Application-defined or object-defined error"
I have shared this with other people and it works for a short time on their computers then gives them the same issue. I had not changed any library or directory information, I then tried to save to desktop and reload but issue remains.
Any help would be appreciated.