Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 34
Default VBA to reattempt to open if file is read only

As per title really

I am making a temporary database in excel which will also be a functional
model for one we are having made externally.

However because of the number of people using it at some point two people
are going to hit the update button at the same time and one of them will get
a read only box appear.

What i would like to do is insead of the 2nd user getting the error message,
for the VBA code to wait 1 second and retry, and repeat until the file opens
before continuing.


Application.ScreenUpdating = False
Application.DisplayAlerts = False
DesignManager = ActiveWorkbook.Name

Workbooks.Open Filename:="J:\ProSys\DataBase\Projects Master.xls"
' If error wait one second and retry
ProjectsMaster = ActiveWorkbook.Name

Any help would be apreciated.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 34
Default VBA to reattempt to open if file is read only

I Assume i would use but never done so before

On Error Resume Next

"Jive" wrote:

As per title really

I am making a temporary database in excel which will also be a functional
model for one we are having made externally.

However because of the number of people using it at some point two people
are going to hit the update button at the same time and one of them will get
a read only box appear.

What i would like to do is insead of the 2nd user getting the error message,
for the VBA code to wait 1 second and retry, and repeat until the file opens
before continuing.


Application.ScreenUpdating = False
Application.DisplayAlerts = False
DesignManager = ActiveWorkbook.Name

Workbooks.Open Filename:="J:\ProSys\DataBase\Projects Master.xls"
' If error wait one second and retry
ProjectsMaster = ActiveWorkbook.Name

Any help would be apreciated.

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10,593
Default VBA to reattempt to open if file is read only

Untested, but try this

Do
Application.Wait Now + TimeSerial(0, 0, 1)
Set wb = Workbooks.Open(Filename:="J:\ProSys\DataBase\Proje cts
Master.xls")
If wb.ReadOnly Then MsgBox "Still in use"
Loop Until Not wb.ReadOnly


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Jive" wrote in message
...
As per title really

I am making a temporary database in excel which will also be a functional
model for one we are having made externally.

However because of the number of people using it at some point two people
are going to hit the update button at the same time and one of them will
get
a read only box appear.

What i would like to do is insead of the 2nd user getting the error
message,
for the VBA code to wait 1 second and retry, and repeat until the file
opens
before continuing.


Application.ScreenUpdating = False
Application.DisplayAlerts = False
DesignManager = ActiveWorkbook.Name

Workbooks.Open Filename:="J:\ProSys\DataBase\Projects Master.xls"
' If error wait one second and retry
ProjectsMaster = ActiveWorkbook.Name

Any help would be apreciated.



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 34
Default VBA to reattempt to open if file is read only

Thank you that works fine and the manual input on the message box prevents
overloading the network with file open requests.

Dont suppose you know how to clear the file now available box that appears
after the code completes?

"Bob Phillips" wrote:

Untested, but try this

Do
Application.Wait Now + TimeSerial(0, 0, 1)
Set wb = Workbooks.Open(Filename:="J:\ProSys\DataBase\Proje cts
Master.xls")
If wb.ReadOnly Then MsgBox "Still in use"
Loop Until Not wb.ReadOnly


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Jive" wrote in message
...
As per title really

I am making a temporary database in excel which will also be a functional
model for one we are having made externally.

However because of the number of people using it at some point two people
are going to hit the update button at the same time and one of them will
get
a read only box appear.

What i would like to do is insead of the 2nd user getting the error
message,
for the VBA code to wait 1 second and retry, and repeat until the file
opens
before continuing.


Application.ScreenUpdating = False
Application.DisplayAlerts = False
DesignManager = ActiveWorkbook.Name

Workbooks.Open Filename:="J:\ProSys\DataBase\Projects Master.xls"
' If error wait one second and retry
ProjectsMaster = ActiveWorkbook.Name

Any help would be apreciated.




  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 34
Default VBA to reattempt to open if file is read only

I modified it to this

Do
Set wb = Workbooks.Open(Filename:="J:\ProSys\DataBase\Proje cts
Master.xls")
If wb.ReadOnly Then Application.Wait Now + TimeSerial(0, 0, 1)
Loop Until Not wb.ReadOnly

Just the workbook now available messagebox to clear now.
Thanks again.

"Bob Phillips" wrote:

Untested, but try this

Do
Application.Wait Now + TimeSerial(0, 0, 1)
Set wb = Workbooks.Open(Filename:="J:\ProSys\DataBase\Proje cts
Master.xls")
If wb.ReadOnly Then MsgBox "Still in use"
Loop Until Not wb.ReadOnly


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Jive" wrote in message
...
As per title really

I am making a temporary database in excel which will also be a functional
model for one we are having made externally.

However because of the number of people using it at some point two people
are going to hit the update button at the same time and one of them will
get
a read only box appear.

What i would like to do is insead of the 2nd user getting the error
message,
for the VBA code to wait 1 second and retry, and repeat until the file
opens
before continuing.


Application.ScreenUpdating = False
Application.DisplayAlerts = False
DesignManager = ActiveWorkbook.Name

Workbooks.Open Filename:="J:\ProSys\DataBase\Projects Master.xls"
' If error wait one second and retry
ProjectsMaster = ActiveWorkbook.Name

Any help would be apreciated.




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
can only open in read only after my pc crashed when the file was o BWAnnie Excel Discussion (Misc queries) 2 November 2nd 07 09:57 PM
can't open file as its read only or encrypted wazzyjan Excel Discussion (Misc queries) 1 January 12th 06 11:18 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
I am getting "unable to read" when trying to open an excel file worf65 Excel Discussion (Misc queries) 4 August 20th 05 11:51 PM
how do i open a file in excel that is encrypted or read only ian c forde Excel Discussion (Misc queries) 0 March 4th 05 02:43 PM


All times are GMT +1. The time now is 08:57 PM.

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

About Us

"It's about Microsoft Excel"