Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do you check to see if a window is open?

Status
Not open for further replies.

q4s72534

MIS
Aug 19, 2003
59
US
i'm writing a script in vb.

1. Check to see if excel booklet .xls is open
true or false?





Just want to say thanks to skip. you're really helping me out.

 
This should work:
Code:
Sub FileIsOpen()
Dim wb As Workbook
For Each wb In Workbooks
    If wb.Name = "ExcelWorkbook.xls" Then
        MsgBox wb.Name & " is open!"
        Exit Sub
    End If
Next
End Sub
The wb.Name "search" is case-sensitive!

I hope this helps!


Peace! [peace]

Mike

Never say Never!!!
Nothing is impossible!!!
 
Stick your head through it..

If you hear a "CRASH! - TINKLE!" sound and your face is covered in blood, it was closed! [rofl]

Chris

Varium et mutabile semper Excel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top