Micro Focus QTP (UFT) Forums
Saving an excel file with the same name and same location after updating few columns - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Saving an excel file with the same name and same location after updating few columns (/Thread-Saving-an-excel-file-with-the-same-name-and-same-location-after-updating-few-columns)



Saving an excel file with the same name and same location after updating few columns - pKrishna - 01-04-2013

Code:
Set objexcel=createobject("excel.application")
Set objworkbook=objexcel.Workbooks.Open("C:\test.xls")
Set objworksheet1=objworkbook.worksheets("test")
objWorksheet1.cells(Row,Column)=Value

objexcel.objworkbook.save


The above line to save the work book is giving me a excel pop up saying that, an excel already exist in the same name. Do you want to save in a different name?

I want to save the same work book. How to do.
Please help


RE: Saving an excel file with the same name and same location after updating - Ankesh - 01-04-2013

You need to disable the display alert option.

Use the below code

Code:
Set objexcel=createobject("excel.application")
Set objworkbook=objexcel.Workbooks.Open("C:\test.xls")
Set objworksheet1=objworkbook.worksheets("test")

objexcel.DisplayAlerts=False 'This will not display any popup

objWorksheet1.cells(Row,Column)=Value
objexcel.objworkbook.save


Regards,
Ankesh