Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 105
Default How to Open file as read only

I want to open a file as read only and get some data from. However when I use
the follwoing code and someone already has the file open, it is as if I
never specified read only in the VBA Code.

If Dir(MyPath & LE_Actuals & "\" & Arr(i)) < "" Then
Workbooks.Open (MyPath & LE_Actuals & Arr(i)), 0, ReadOnly = True
ActiveWorkbook.Windows(1).Visible = False
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How to Open file as read only

as written you are comparing the uninitialized variable ReadOnly to the
boolean value True. For named arguments you use colon equal

ReadOnly:=True

--
Regards,
Tom Ogilvy

"Helen" wrote in message
...
I want to open a file as read only and get some data from. However when I

use
the follwoing code and someone already has the file open, it is as if I
never specified read only in the VBA Code.

If Dir(MyPath & LE_Actuals & "\" & Arr(i)) < "" Then
Workbooks.Open (MyPath & LE_Actuals & Arr(i)), 0, ReadOnly = True
ActiveWorkbook.Windows(1).Visible = False



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
FILE CAN ONLY OPEN AS READ ONLY vcff Excel Discussion (Misc queries) 2 November 18th 08 11:18 AM
Can't Open a Read-Only file in Excel 03 Josh C Excel Discussion (Misc queries) 0 February 12th 08 10:09 PM
Excel file won't open because it' a read only file when it is not IanB Excel Discussion (Misc queries) 1 September 12th 05 01:28 PM
Open File Read Only Chris Excel Programming 1 September 23rd 04 12:11 AM
File in use open read only jeffP Excel Programming 0 August 21st 04 06:37 PM


All times are GMT +1. The time now is 12:51 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"