LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default stopping an excel application from vb 6.0

Help!!!!!
I have an application that loads an excel spreadsheet and transfers the
data from it to a sql server database. This part of the program works
wonderfully.
The problem is that the excel spreadsheet does not close even after the
application is shut down.
It continues to run in the background and keeps the worksheet open.
Here is the code I use to load the excel spreadsheet, it is activated by
a click event from a button.

Dim EXELAPT As excel.Application
USERFILE = "F:\SPECS\PRODUCTION\" & intfindno & ".XLS"
'USERFILE = "F:\SPECS\PRODUCTION\" & Me!FINDNO.Value & ".XLS"
ROW = "B179"

Set EXELAPT = CreateObject("EXCEL.APPLICATION")

Set MYBOOK = Workbooks.Open(FileName:=USERFILE)
EXELAPT.Workbooks.Open USERFILE
EXELAPT.Visible = True
EXELAPT.Worksheets("shop spec").Select

EXELAPT.Range(ROW).Select
EXELAPT.ActiveCell.FormulaR1C1 = "=NUMBER"
If IsError(ActiveCell) = True Then GoTo 2
adosecondaryrs.Fields("spec_list_job") = Range(ROW)

After all of the data is transfered I update the recordset and then
close the excel application. This works for all the next spreadsheets
that I open but not for the first one.

Here is the code I use to close the excel application:

Set EXELAPT = Nothing
Set MYBOOK = Nothing
2770 EXELAPT.Application.Quit
EXELAPT.Application.Kill
excel.Application.Quit
excel.Application.Kill

Set EXELAPT = Nothing
Set MYBOOK = Nothing

I had the same problem in an Access aplication I wrote using vba but
resolved the problem by inserting an "end" statement.
I don't want to do that here, because I do not want to terminate the vb
application.

Also is there any way to load an excel spreadsheet as a file and not as
a spreadsheet? This might fix the problem out right.

Thank you for your time, it is much appreciated.


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Stopping Zoom feature in Excel PJ Excel Discussion (Misc queries) 0 February 21st 10 11:08 PM
Starting and Stopping excel from command line. Bruce Edwards Excel Discussion (Misc queries) 1 April 27th 08 06:34 PM
Stopping Excel macro pattern recgonition mal1920 New Users to Excel 2 November 17th 05 05:10 AM
stopping backup of Excel spreadsheet lggallo Excel Worksheet Functions 2 May 18th 05 07:05 PM
macro to close excel application other than application.quit mary Excel Programming 1 September 14th 04 03:43 PM


All times are GMT +1. The time now is 04:20 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"