Document Not Saved Error in Excel.

Posted by Sowmya on Stack Overflow See other posts from Stack Overflow or by Sowmya
Published on 2009-10-23T06:51:39Z Indexed on 2010/05/10 13:34 UTC
Read the original article Hit count: 243

Filed under:
|
|
|

This is my code snippet for comparing 2 excel files. I call this function from my QTP scripts. I get this error quite often which causes my test script to fail. Any pointers will be appreciated.

Set objExcel = CreateObject("Excel.Application")
objExcel.Application.Visible = False
objExcel.DisplayAlerts = False
Set objWorkbook1= objExcel.Workbooks.Open(excelFile1)
Set objWorkbook2= objExcel.Workbooks.Open(excelFile2)

Set objWorksheet1= objWorkbook1.Worksheets(1)
Set objWorksheet2= objWorkbook2.Worksheets(1)

<Code that compares the 2 files & marks the cell in red where there is a mismatch)
objWorkbook2.Save

ERROR MESSAGE:
Document not saved.
Function file: C:\Program Files\Mercury Interactive\QuickTest Professional\Tests\ReusableFunctions.qfl
Line (33): "objWorkbook2.Save".

© Stack Overflow or respective owner

Related posts about qtp

Related posts about quicktest-pro