benong
10-25-2010, 01:33 AM
hi,
i want to achieve something like this through a button on a userform:
If i try to open a workbook and that workbook is currently in use by other user. Then it will try to open the workbook again at 2 sec later, make 5 attempts before it decide to pop up message box to ask user to try again later. How to put that in code? I tried but failed. Below is my code
On Error Resume Next
Do
Set wbk = Workbooks(DB_Workbook)
Application.Wait (Now + TimeValue("00:00:5"))
Loop Until Err <> 0
i want to achieve something like this through a button on a userform:
If i try to open a workbook and that workbook is currently in use by other user. Then it will try to open the workbook again at 2 sec later, make 5 attempts before it decide to pop up message box to ask user to try again later. How to put that in code? I tried but failed. Below is my code
On Error Resume Next
Do
Set wbk = Workbooks(DB_Workbook)
Application.Wait (Now + TimeValue("00:00:5"))
Loop Until Err <> 0