View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
yogendra joshi yogendra joshi is offline
external usenet poster
 
Posts: 48
Default Open Excel file as Read Only with code,

You can use Open Method with optional parameter ReadOnly = True

See following code

Sub open_Read_Only()
Workbooks.Open Filename:="D:/test.xls", ReadOnly:=True
End Sub

Hope this helps

~Yogendra


Jason Wooten wrote:
I have several spreadsheets that are Read Only, Every macro that I have opens the files but ask if you want to open as Read Only or not,
Is there any way that I can write something that will open the file as Read Only or Read Write without it asking.
I am wanting to put this in the Code, but do not know how..

Thanks in advance for your help..

Jason