Error 1004 Document not saved one user only; macro to publish as .pdf Excel 2016

pete234

Active Member
Joined
Feb 10, 2004
Messages
419
I have a macro that publishes a file to a Sharepoint folder from within an Excel document.
One user out of 5 is having an issue where it gets to the end of the publishing status bar and suddenly it goes bonkers with "1004 document not saved".
This person has a slightly later version of Excel Build but it seems unlikely that would be the cause. We all have 2016 full desktop plus 365.
I searched here and online but I only find reference to 2007.
The user has full access to the folder in sharepoint and can upload files there.

Debug Highlights Active.Workbook but doesn't go into details.

Sub Publish()

'Publish PDF Macro
myResponse = MsgBox("Are you sure you want to publish?", vbYesNo)
If myResponse = vbNo Then Exit Sub
ActiveWorkbook.ExportAsFixedFormat Type:=xlTypePDF, Filename:="https://sharepoint.com/Departments//Dept..." & "_" & Environ("UserName") & "_" & Format(Now(), "mm.dd.yy hh.mm")

End Sub

Any insight on what to check for would be appreciated.
 
Last edited:

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Can't really help much, but.....have you tried changing the save location to a local server or drive.
The OP may have an sharepoint access issue.:confused:
 
Upvote 0
I guess it must be something in Share Point but I don't think we have any users set up differently.
(I don't have access to know though.)
But good point, I should try with a different path and see if he still gets error. thanks
 
Last edited:
Upvote 0
Solved: the solution was to go through the manual save process first (save as and publish) to the specified folder in Share Point before the macro would run.
It only occurred with users who have Excel 365 (Not 2016). Once we saved a test file (not even the actual files in question) the macro would run without issue.
The same users had no issues using the same macro to save to a local shared drive.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,561
Messages
6,120,225
Members
448,951
Latest member
jennlynn

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top