Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB6 and Excel 97 automation

Status
Not open for further replies.

netizen

Programmer
Aug 27, 2002
24
0
0
IN
Hi! All,
I'm working with VB6 and Excel 97 object Library. I would like to know how do i close the instance which is opened upon the following statement.

I'm opening an excel workbook from App.path using the following statement:

strFileName="C:\Work\abc.xls"
Set oBook = Workbooks.Open(strFileName)
Once the abc.xls is opened, i use:
Application.Visible = True , which will show the Excel sheet.

Now the problem is even after i close this workbook using the 'File-->Close' or 'X' mark the excel instance is still open, which I can see using the Task Manager.

I want to know how do i close this instance programatically upon closing the excel workbook or the whole excel environment physically using 'File-->Close' or 'X' mark?

thanks in advance,

Regards,
netizen
 
try setting your objects to nothing

i.e.

obook.Close 'close workbook
Set oBook = Nothing 'Kill Workbook object
Set Application = Nothing 'Kill Excel Application Gary Parker
Systems Support Analyst
 
Try to use application.visible = true before opening the workbook. This has helped me when my instance of Excel wasn't unload when the user closes the workbook instead of the Excel.

Andreas
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top