Forum Discussion

mBocuk's avatar
mBocuk
Copper Contributor
Nov 10, 2023

Error 1004

Hello
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".



When i click the pdf button;

 

1)

"Print
An error occurred while printing."

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

2)

 

"error 1004"

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



Thank you for help.

 

  • JKPieterse's avatar
    JKPieterse
    Silver Contributor
    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.
    • mBocuk's avatar
      mBocuk
      Copper Contributor
      Hello
      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.
      • JKPieterse's avatar
        JKPieterse
        Silver Contributor
        Does it help to add the folder to the trusted folders (if that is something Mac Excel allows you to do that is)

Resources