Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
test for workbook open
Need a method to see if a file (WORKBOOK) is in use so the
file open command via VBA does not open it read only. It should display a warning and then a time delay. Thanks! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
test for workbook open
Rich,
Here is one way. It opens the book and then closes it if it is read only Dim sFile As String sFile = "C:\myTest\Volker1.xls" On Error GoTo file_error Workbooks.Open Filename:=sFile If ActiveWorkbook.ReadOnly = True Then CreateObject("WScript.Shell").Popup sFile & " is in use/read-only", 5, "Title", vbYesNo ActiveWorkbook.Close savechanges:=False Exit Sub End If Exit Sub file_error: MsgBox "Error " & Err.Number & " on file " & sFile -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Rich C" wrote in message ... Need a method to see if a file (WORKBOOK) is in use so the file open command via VBA does not open it read only. It should display a warning and then a time delay. Thanks! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to: Open closed workbook/Search data tables/Return data to open workbook | Excel Discussion (Misc queries) | |||
how do i open a data workbook when i open a timesheet workbook | Excel Discussion (Misc queries) | |||
VBA Assistance needed to test for open file in a different direct | Excel Discussion (Misc queries) | |||
Test to see if a workbook is open | Excel Discussion (Misc queries) | |||
Test to see if a spreadsheet window is open | Excel Programming |