How do I put read only warning on macros

ghrek

Active Member
Joined
Jul 29, 2005
Messages
426
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

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
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,213,504
Messages
6,114,016
Members
448,543
Latest member
MartinLarkin

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