Trying to work with UFT and a dynamically generated Excel file
Question ID: 107549

I have an odd testing need with UFT. The application I am testing generates a dynamic Excel file that I need to edit with UFT, but I don’t know what the file name or anything will be until the test executes half-way. Is there any trick to work with a spreadsheet like this in UFT?

Marked as spam
Posted by (Questions: 227, Answers: 22)
Asked on April 18, 2017 8:06 pm
Answers (1)
Private answer

You could access the information about the new Excel file using the GetObject and then a few properties. Store them in variables to use later in your script or whatever you are trying to do in the test. The code below will get you the path, name, and full name of the Excel Sheet that is opened from your application:

Dim objXCL
Dim XCLpath
Dim XCLname
Dim XCLfullname

OnError Resume Next
Set objXCL = GetObject(,''Excel.Application'')
If Not TypeName(objXCL) =''Empty'' Then
XCLpath = objXCL.Workbooks(1).path, vbInformation, ''Excel Status''
XCLname = objXCL.Workbooks(1).name, vbInformation, ''Excel Status''
XCLfullname = objXCL.Workbooks(1).fullname, vbInformation, ''Excel Status''

MsgBox ''Excel file is not open'', vbInformation,''Excel Status''

End If

Marked as spam
Posted by (Questions: 2, Answers: 477)
Answered on April 18, 2017 8:09 pm

Welcome back to "EyeOnTesting" brought to you by Orasi Software, Inc.

Scroll to Top