|
-
Mar 30th, 2006, 06:36 AM
#1
Thread Starter
Junior Member
[RESOLVED] Open excel file in read only mode
I want to open office files say...excel in read only mode thru my vba.can anyone plz help me out.i can open them but cant specify the access modes.
can anybody please help me out......
-
Mar 30th, 2006, 06:58 AM
#2
Re: Open excel file in read only mode
Why don't you change the file attributes to Read Only before you open it? Or can't you change file attributes in VBA?
Keith
I've been programming with VB for 25 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.
-
Mar 30th, 2006, 07:08 AM
#3
Re: Open excel file in read only mode
The best way would be to use Command Line switches. To open a file as Readonly you can use
Code:
Excel.EXE /r myFile.xls
Use [code] source code here[/code] tags when you post source code.
My Articles
-
Mar 30th, 2006, 07:11 AM
#4
Re: Open excel file in read only mode
VB Code:
Dim oApp As Excel.Application
Set oApp = New Excel.Application
oApp.Workbooks.Open Filename:="C:\MyFile.xls", ReadOny:=True

Ps, Congrats Shuja Ali on your 700 posts!
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Mar 30th, 2006, 07:15 AM
#5
Re: Open excel file in read only mode
 Originally Posted by RobDog888
Ps, Congrats Shuja Ali on your 700 posts! 
Thanks
Use [code] source code here[/code] tags when you post source code.
My Articles
-
Mar 31st, 2006, 12:33 PM
#6
Thread Starter
Junior Member
-
Mar 31st, 2006, 12:58 PM
#7
Re: Open excel file in read only mode
 Originally Posted by cswaroopsaha
 Thanks a lot.....
This helped me again.. 
If this is resolved, please pull down the Thread Tools menu and click the Mark Thread Resolved button. That will let everyone know that you have your answer.
Thank you.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|