I am working on UFT tool.
I am working on a client server application when i run my script, my application open an excel file (csv content is displayed in excel file as table format)
My need: I need to do a saveAs of the opened excel file to a new file (ex:report.csv) (Note: reason i am doing save as is because, my file which opened by default generated a unique number keys after the file name (ex report-3214405) , which i couldnt use to compare the data with existing file i saved.. So i was trying to save the opened Excel file to another file name )
i did the following : path i defined 1)Dim abc: abc = testDataPath & "\output\report.csv" 2) Runs my application and Excel file opens. 3) Call SaveAsExcelAndCloseFile3(abc ) Public Function SaveAsExcelAndCloseFile3(abc )
str1 = "Set x1 = GetObject(,""Excel.Application"")"
Execute str1
Set a1 = x1.Worksheets(1)
'Set objWB = x1.ActiveWorkbook
'objWB.SaveAs(abc)
a1.SaveAs abc
x1.ActiveWorkbook.Close True
x1.Application.Quit
Set a1 = nothing
Set x1 = nothing
End Function
I am getting Error which says "Object required "objWB.SaveAs(path...)
Aucun commentaire:
Enregistrer un commentaire