Compile Error trying to open password protected file

Mark Lane

New Member
Joined
Nov 29, 2018
Messages
2
I am working on windows 10, Excel 2016.

The file i was creating is to be a shared file, which will have data input by numerous peope with the data then being transferred into anothe file for another department to review.
The code written closed the 2nd file when the data was transferred, and i found the following code which worked to wait until any previous action was complete before adding the next set of data

Do

Application.Wait Now+ TimeSerial(0, 0, 1)
Set wb =Workbooks.Open(Filename:="S:\ULR\Projects\Projects\Cheque Requests\Requestlog.xlsm")
If wb.ReadOnly Then

Loop Until Notwb.ReadOnly

Then rest of code

The problem i am now having is the 2nd file now needs to be password protected, and when trying to add the standard "Password:="Password"" to the open file command i get the folowing

Compile error: Expected: end of statement, or Compile Error: Syntax Error

I am at a loss on how to get this to work as it worked perfectly fine before the introdution of a password

Any assistance would be greatly appreciated
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
????
Code:
Loop Until [COLOR=#ff0000]Notwb[/COLOR].ReadOnly

perhaps
Code:
Loop Until Not wb.ReadOnly
 
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,186
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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