MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Excel file awareness in VB

Posted by vbnewby on February 27, 2001 10:46 AM

I have a similar problem as Guru (earlier date), in that I use VB to check out some Excel files useing data in a presetup & loaded Excel file. I have problems keeping track of the other Excel files that are opened and closed while my VB prog is running using an Excel file. Sounds confusing, but there must be a way to be aware of other Excel files being opened and closed while using the VB prog that uses an Excel file for data. (what a mouthful!) HELP!!!

Posted by David Hawley on February 27, 2001 1:27 PM

Hi vbnewby

Here is one method, just replace "Book2.xls" with a String variable.

Dim IsOpen As Workbook
On Error Resume Next
Set IsOpen = Workbooks("Book2.xls")
If IsOpen Is Nothing Then
MsgBox "Not Open"
End If

OzGrid Business Applications