| || |
Save an excel file in C directory.
I am automating a web-application.
once I click on a excel sheet image the excel sheet is opened and then it gives a message. This is not corrupted and is a trusted source opening the file. Do you want to open the file now?
I click yes and then the excel sheet opens. How can i save this file in my local directory.
Please give answer if you really worked on this before.
No guesses or weird answers.
Re: Save an excel file in C directory.
The best way is to create an excel object first then you can manipulate and save it wherever you want.
i.e. here is a snippet of code i use so you can get some ideas:
<font class="small">Code:</font><hr /><pre>
Update = 2
sWrite = Update - 1
'Update the Update field from in the spreadsheet, Save and Quit
sFileNameWithPath = "C:\QTPAutomation\SOMEPROJECTFOLDER\Data\SMOKETEST S_Data.xls"
sSheetName = "Login"
Const xlSaveChanges = 1
<font color="green"> Set objExcel = CreateObject("Excel.Application")</font>
objExcel.Visible = False
Set objSheet = objExcel.ActiveWorkbook.Worksheets(sSheetName)
objSheet.Cells(2, 5).Value = sWrite
Hope that helps ya.
You can also save it to a different path objExcel.ActiveWorkbook.Save (sFileNameWithPath_2)