VBA Password to modify file and read only

csilabgirl

Active Member
Joined
Aug 14, 2009
Messages
359
excel 2002

I have a workbook set up (called Client List) with a password to modify, so that when the user opens it, they can either enter a password to get write access or they can just click read only.

Then I have another workbook with a private sub workbook_open event which opens the "Client List" workbook. Because of the password to modify setting, it asks the user if they want to enter the password or choose read only. When the "Client List" workbook is opened through the other workbook , I always want it to open as read only and not ask the user.

Is there something I can add to my code that will do this for them so they dont always have to click the button? Below is my code


Private Sub Workbook_Open()
Dim wbOpen As Workbook

Set wbOpen = Workbooks.Open(FileName:="\\Server\Chromosomal Labs\ChromoLIMS\Client List.xls")

wbOpen.Sheets("Clients").Columns("A:CZ").Copy
ThisWorkbook.Sheets("CL Paste").Columns("A:CZ").PasteSpecial Paste:=xlPasteValues
Application.CutCopyMode = False
wbOpen.Close

Thank you for your help!
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Try

Set wbOpen = Workbooks.Open(Filename:="\\Server\Chromosomal Labs\ChromoLIMS\Client List.xls", ReadOnly:=True)
 
Upvote 0

Forum statistics

Threads
1,224,504
Messages
6,179,142
Members
452,892
Latest member
JUSTOUTOFMYREACH

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