VBA Run-time error '1004

Carl Clements

Board Regular
Joined
Jun 13, 2008
Messages
95
Hi,

I'm trying to write an Excel macro that Password protects a file for modification. However, I get the following error:

Run-time error '1004:
Operation failed. 'P:\(Drive location.....)' is write reserved

The macro is doing SaveAs - Tools - General Options - Password to modify - OK

The code is below:
ActiveWorkbook.SaveAs Filename:= _
"P:\Daily P&V\Clients\Cyrte & LODH\Cyrte & LODH AM 2.xls", FileFormat:= _
xlNormal, Password:="", WriteResPassword:="ldvt", ReadOnlyRecommended:= _
False, CreateBackup:=False

Can anybody advise what the problem is?

Thanks,
Carl
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
hmm the only other thing I can think of would be, when i protect something I have to specify what users can access it. maybe you need to fill that out programmically?
 
Upvote 0

Forum statistics

Threads
1,224,522
Messages
6,179,292
Members
452,902
Latest member
Knuddeluff

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