Frequent Contributor.
Frequent Contributor.

catch opened Ecxel fileI ("","Excel.Application") or (,"Excel.Application")?

I need to cach opened excel file

I use code. Its worked. But then I want to save test, system give me “Expected expression”, that must be: GetObject(“”, "Excel.Application"). but its not work. cannot cath opened Excel. look at the screen

I Use UFT 15.01

Dim objXL

On Error Resume Next

Set objXL = GetObject(, "Excel.Application")

If Not TypeName(objXL) = "Empty" then

    MsgBox objXL.Workbooks(1).path, vbInformation, "Excel Status"

    MsgBox objXL.Workbooks(1).name, vbInformation, "Excel Status"

    MsgBox objXL.Workbooks(1).fullname, vbInformation, "Excel Status"


    MsgBox "Excel NOT Running", vbInformation, "Excel Status"

End If

1 Reply
Micro Focus Expert
Micro Focus Expert

Try this.

Set objXL = CreateObject("Excel.Application")

Below is the help link.


And you may also find the UsingExcel.vbs in the sample code under UFT installations.

The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.