08-28-2014, 01:48 PM
Hi Team,
I am trying to save an Excel generated by an application to my local drive. When the excel is generated, I do not know the worksheet name, so I tried the following code :
But QTP throws an error stating : Object required at line number 4 (xlBook.Activate).
I am not able to understand the issue here, as the Excel is open and I can see it.
Any help is appreciated.
Thankx.
I am trying to save an Excel generated by an application to my local drive. When the excel is generated, I do not know the worksheet name, so I tried the following code :
Code:
Set objExcel = Eval("GetObject(,""Excel.application"")")
objExcel.DisplayAlerts = False
Set xlBook=objExcel.Workbooks
Set xlBook = objExcel.ActiveSheet
xlBook.Activate
xlBook.SaveAs("c:\test.xls")
But QTP throws an error stating : Object required at line number 4 (xlBook.Activate).
I am not able to understand the issue here, as the Excel is open and I can see it.
Any help is appreciated.
Thankx.