Excel File SaveAs Command in Excel

Joined
Jun 8, 2005
Messages
5
Reaction score
0
Hello,

I have a macro which saves two files, one that I use as a master and the other that users in the business use. The excel file is a series of pivot tables which are linked to an MS Access database.

The macro refreshes the pivot tables and then saves the data in two different locations. There is a password on the file as some of the data is sensitive. My problem is that the save macro states that the file is Run-Time error 1004 operation failed the file name and then is write reserved.


ActiveWorkbook.SaveAs "\\servername\directory\folder\filename.xls" _
, FileFormat:=xlNormal, Password:="password1", WriteResPassword:="password2", _
ReadOnlyRecommended:=False, CreateBackup:=False

I'm not too sure what how to get round this, the Excel help states to use the ChangefileAccess command which I tried to incorporate, but got lost along the way....

Can anyone help as I am not a VBA programmer ?????

Many thanks
Angie
 
Last edited:
Joined
Jun 8, 2005
Messages
5
Reaction score
0
Hello,
Thanks for taking a look for me, I applied the SP but unfortunately this didn't resolve the problem.
I also tried the file save copy as function works, but doesn't have the facility to save with the relevant passwords.
I'm not sure how excel goes on about saving a file whether it opens it somehow in memory and at that point decides it's write reserves as it has passwords on it before processing the bit of the macro that saves the file.
The changefileaccess method states that to use this it would have to open a copy of the file in order to change its status .. but I'm ot sure how to incorporate this in to the code and the help doesn't give any specific details.
Thanks for looking at this for me
Regards
Angie
 

crazylegs

Member Extraordinaire
Joined
Dec 31, 2004
Messages
5,743
Reaction score
64
Thats ok Angie were here to help...only wish i could help a little further but i'm no expert on excel...I just searched the Microsoft Knowledge Base and they had a solution to your problem....


Have you rebooted the machine after applying the update, make sure you do this then try again, I'm sure the solution lies in that Article...:)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Excel Excel Macro how to prompt for save name 1
Excel Bug in Excel 2007? Activewindow 0
Save As Macro 2
Need Help with VBA SaveAs 1
Hiding an Excel file using VBA 1
SaveAs to existing file 5
Simplify save code 11
File SaveAs 1

Top