WorkBook.Save problem URGENT

P

Papp György

Hi

I would like to save a workbook but nothing occurs except that the Excel
application gets stuck in the memory.

The code is the following :

Dim mExcel As New Excel.Application

Set mWorkBook = mExcel.Workbooks.Open(FileName)

With mWorkBook

Set mWorkSheet = .Worksheets(TagetWorksheetIx)

End With

call FillSameCells ' I checked the cells and they are filled properly.

mWorkBook.Save
mWorkBook.Close
set mWorkBook = nothing : set mWorkSheet = nothing : set mExcel = nothing :

The created file can't be deleted because an invisible excel application
locked the file.
The created file is empty.
 
T

Tony Jollans

You must quit Excel before setting the pointer to nothing ....

mWorkBook.Save
mWorkBook.Close
mExcel.Quit '<=== Add this line
set mWorkBook = nothing : set mWorkSheet = nothing : set mExcel = nothing :
 
P

Papp György

Dear Tony

Thanx a lot, it solved my problem.



Tony Jollans said:
You must quit Excel before setting the pointer to nothing ....

mWorkBook.Save
mWorkBook.Close
mExcel.Quit '<=== Add this line
set mWorkBook = nothing : set mWorkSheet = nothing : set mExcel = nothing :

--
Enjoy,
Tony


nothing
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top