Problem while appending excel file
I have created an excel file. I want to open it in append mode, write some data and save it.
Here is code
Set ExcelApp = CreateObject("Excel.Application")
Set NewWorkbook = ExcelApp.Workbooks.Open(sPath)
Set OpenWorkbook = NewWorkbook
Set sheet = ExcelApp.Worksheets.Item(1)
sheet.Cells(row, col) = value
(Assume that file is already created - sPath is the path)
But after executing this code when I open the file , I get the popup saying Do I want to save the changes ? If I click on Yes, it opens Save As window.
Can anybody tell me how to open existing excel file in APPEND/WRITE mode, enter data and save it with original name and path ?
Re: Problem while appending excel file
Enter the following codes after sheet.Cells(row,col)=value
Set sheet = Nothing
Set OpenWorkbook = Nothing
Set NewWorkbook = Nothing