How do I put read only warning on macros

ghrek

Active Member
Joined
Jul 29, 2005
Messages
427
Hi

I have macros that are shortcuts to books that numerous people use.

I know how to record the macro to open the book but dont know what to add when its opening as a "READ ONLY" as in the message box warning it read only.

Can anyone help?
 

Excel Facts

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

Code:
Dim wb As Workbook

Set wb = Workbooks.Open("C:\Steve\Desktop\whatever.xlsx", ReadOnly:=True)
 
Upvote 0
Thanks for that.

I put this in as a macro and keep getting file dont exist but it does.

Sub Macro7()
'
' Macro7 Macro
'
Dim wb As Workbook

Set wb = Workbooks.Open("\\lo-nas01\arrivashared\Passenger Accounts\SHARED\passacc\Excel\passacc\CCREFUND LOROL ", ReadOnly:=True)
'
End Sub

Is it because someone has it open already?
 
Upvote 0
Put the extension in (eg .xlsx) and i doubt your file name ends in a space.
 
Upvote 0

Forum statistics

Threads
1,224,817
Messages
6,181,144
Members
453,021
Latest member
Justyna P

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