blckngldhwk
Technical User
I have programmed this type of command for IE in the past but am having problems getting it to work for Excel.
I'm wanting to check to see if a particular file is already open. If it is open I want to activate it, otherwise I want to open it.
Here is the code that I have used for IE, can you advise how to modify for Excel?
I'm wanting to check to see if a particular file is already open. If it is open I want to activate it, otherwise I want to open it.
Here is the code that I have used for IE, can you advise how to modify for Excel?
Code:
Set oIE = Nothing
Set oApp = CreateObject("Shell.Application")
For iApp = 1 To oApp.Windows.Count
Set oWin = oApp.Windows(iApp - 1)
If InStr(oWin.Name, "Windows Internet Explorer") Then
sURL = oWin.LocationURL
On Error Resume Next
Set oTitle = oWin.Document.GetElementsByTagName("title")
On Error Goto 0
If Not oTitle Is Nothing Then
If oTitle(0).innerHTML = "WindowName" Then
Set oIE = oWin
AppActivate "WindowName"
End With