Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I want to Save the excel file without a save as window
#1
Solved: 11 Years, 3 Months, 3 Weeks ago
Hi All,

Please let me know if there is something wrong with this code, I keep getting a pop up message to save the file and I am given an option to save as a different file and can't append an existing file. Any help is much appreciated:
Code:
sourcefile = [code]"\\..\..\Type_QTP.xls"
        Set xlApp = CreateObject("Excel.Application")
        Set xlWorkBook = xlApp.Workbooks.Open(sourcefile)
                Set xlWorkSheet = xlWorkBook.Worksheets("Sheet1")

           xlWorkSheet.Range("G2:G20") = "Some data"

    xlWorkBook.Save
    xlWorkBook.Close
    xlApp.Quit
    
    ' Destroy all the Objecte references
    Set xlApp = Nothing
    Set xlWorkBook = Nothing
    Set xlWorkSheet = Nothing


Thanks,
Mouli
Reply
#2
Solved: 11 Years, 3 Months, 3 Weeks ago
Hi,

Try as given below.

Code:
sourcefile = "\\..\..\Type_QTP.xls"
Set xlApp = CreateObject("Excel.Application")
xlApp.Workbooks.Open(sourcefile)
xlApp.sheets("Sheet1").Select
xlApp.sheets("Sheet1").Range("G2:G20") = "Some data"
xlApp.ActiveWorkBook.Save
xlApp.Application.Quit
Set xlApp = Nothing
Reply
#3
Solved: 11 Years, 3 Months, 3 Weeks ago
Excellent... Thanks Sreekanth...your solution worked....
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Save scripts from QC to Local Disk-need help with code monsuer15 1 3,192 10-10-2017, 03:08 PM
Last Post: bela.chuphal
  Object doesn't support this property or method: 'window(...).window(...).winobject' senthil5683 1 3,674 07-04-2016, 07:08 PM
Last Post: venkatesh9032
  How to update CSV File and need to Save same CSV File kotaramamohana 1 3,510 10-24-2015, 08:40 AM
Last Post: tigerliew
  Not able to click the save button in Save As window while downloading from SAP kathirvelnagaraj 0 2,458 08-25-2015, 07:37 PM
Last Post: kathirvelnagaraj
Sad Save data from pdf file to a word doc Amar 0 2,622 12-12-2013, 12:29 PM
Last Post: Amar

Forum Jump:


Users browsing this thread: 1 Guest(s)