Error 1004

Copper Contributor

I will be very grateful if you help me.
I have a Mac mini with Sonoma 14.1. Before the update to Sonoma worked everything well without any problem. After update to Sonoma, my Excel file shows error 1004 when I click the button that I created.
I made a pdf button to save the worksheet as pdf to my folder with the name of invoice number. When I click on that button; the error 1004 shows up. I made also a button to save the whole excel file to the same folder with the name of invoice number. This also shows error 1004.

I've found a temporarily solution; when I change the name of my file, and change this also on vba, it works. When I slumber my mac and open after 10-12 hours, I get the same issue and I need to change the name of my folder and on vba again. Sometimes Excel doesn't accept used names. Then I need delete that file, create a new file and use the names again. When I open new file, Excel asks for permission to use that file. I give the permission. After slumbering my mac and after 10-12 hours the error occurs again. 


Could anyone help me please? 

My excel is in Dutch. I will translate.


This is my sheet: PDF button and next to it is just "save as".

Scherm­afbeelding 2023-11-10 om 05.46.54.png

When i click the pdf button;



Scherm­afbeelding 2023-11-10 om 04.55.26.png

An error occurred while printing."

I don't know why it's trying to printing.


Scherm­afbeelding 2023-11-10 om 04.55.34.png


"error 1004"

3) the vba code. First button is save as pdf. Second button is just save as

Scherm­afbeelding 2023-11-10 om 04.55.52.png

Thank you for help.


6 Replies
Try recording a macro when you export the sheet to PDF (File, Export, XPS/PDF button). Once the PDF has been created, stop recording and compare the newly added macro to the one causing the issue.
I did like you said. It just added " ChDir "/Users/NAME/Desktop/FOLDERNAME/" " and the rest is same.
When i save manualy there's no problem. But when i use button it gives same error.
Does it help to add the folder to the trusted folders (if that is something Mac Excel allows you to do that is)
Thanks for response and sorry for late respons.
When I change the name of the folder, Excel ask for permission to trust the folder. But after 12hours the error occurs again.

I have separated the folders. So saving pdf's to one folder and save as excel (.xlsm) to another folder. For save as pdf there's no problem anymore. For saving pdf is working.
But the problem is just now only on save as. The error occurs on save as xlsm file. So I have to change folder name again etc. Do you have any ideas?

@mBocuk I'm afraid not. Perhaps @Ron de Bruin knows?

@Jan Karel Pieterse 


Check out this page : Sandbox | Mac Excel Automation


See how I use it on this page to save as pdf so there are no warnings : PDF | Mac Excel Automation


If you need more help let me know