Unclosed MSExcel instance 
Author Message
 Unclosed MSExcel instance

I currently have an Excel Spreadsheet managed by a Visual Basic project.
This is working well except for one problem.

Once the execution has finished , the program close itself but an excel
instance remain open.

Now I know everyone is probably saying, "Well you haven't closed your
objects properly". So here is what code I am using to declare the objects:
(I'm using Vb6, MSOffice 2000 Pro, WindowsXp)

Option Explicit
Public FileExcel As Workbook

Private Sub MDIForm_Load()
        Set FileExcel =  Excel.Workbooks.Open(App.Path & "\Ges.xls")
End Sub

Private Sub MDIForm_Unload(Cancel As Integer)
 FileExcel.Close (True)
 Set FileExcel = Nothing
 End
End Sub

Thanks again,
Fabio



Fri, 29 Jul 2005 23:45:00 GMT  
 Unclosed MSExcel instance
See inline solution



Quote:
>I currently have an Excel Spreadsheet managed by a Visual Basic project.
>This is working well except for one problem.

>Once the execution has finished , the program close itself but an excel
>instance remain open.

>Now I know everyone is probably saying, "Well you haven't closed your
>objects properly". So here is what code I am using to declare the objects:
>(I'm using Vb6, MSOffice 2000 Pro, WindowsXp)

>Option Explicit
>Public FileExcel As Workbook

>Private Sub MDIForm_Load()
>        Set FileExcel =  Excel.Workbooks.Open(App.Path & "\Ges.xls")
>End Sub

>Private Sub MDIForm_Unload(Cancel As Integer)
FileExcel.Quit
> FileExcel.Close (True)
> Set FileExcel = Nothing
> End
>End Sub

>Thanks again,
>Fabio



Sat, 30 Jul 2005 00:22:23 GMT  
 Unclosed MSExcel instance

Quote:

>I currently have an Excel Spreadsheet managed by a Visual Basic project.
>This is working well except for one problem.

>Once the execution has finished , the program close itself but an excel
>instance remain open.

>Now I know everyone is probably saying, "Well you haven't closed your
>objects properly". So here is what code I am using to declare the objects:
>(I'm using Vb6, MSOffice 2000 Pro, WindowsXp)

>Option Explicit
>Public FileExcel As Workbook

>Private Sub MDIForm_Load()
>        Set FileExcel =  Excel.Workbooks.Open(App.Path & "\Ges.xls")
>End Sub

>Private Sub MDIForm_Unload(Cancel As Integer)
> FileExcel.Close (True)
> Set FileExcel = Nothing
> End
>End Sub

>Thanks again,
>Fabio

Fabio,

I had the exact same problem a while back.  I did a lot of searching, but I
finally figured it out.  For some reason (God knows why!) if you access the
spreadsheet a lot of times, the instance won't close (strange, but true).  In
my case I was writing a program that would read a text file and cull certain
data. I then had to put the data on the spreadsheet.  Then I had to get some
other data, take each value and read through the spreadhseet till I found a
match, and do some other stuff.  That's where the problem was.  Instead of
reading through the spreadsheet, I saved the original data in an array, did my
comparisons from the array, then put more stuff on the spreadsheet (which was
WAY QUICKER as well, and really is how it should be done).  Problem
gone.......Ted



Tue, 02 Aug 2005 02:49:02 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Unclosed quote in parameter with "( )"

2. ADO Cutting string (unclosed quotation mark before error)...

3. from MSaccess to MSexcel...SUBTOTAL

4. MSExcel as OleAutomation and NTService?

5. From MSExcel to MSExchange??

6. Problem with ContentType = application/x-msexcel

7. Problem with MsExcel 97 SR-2 Excel.Application object in VB98

8. Problem with MsExcel 97 SR-2 Excel.Application object in VB98

9. Problem with MsExcel 97 SR-2 Excel.Application object in VB98

10. Close MSExcel "completely"?

11. VB5 to MSExcel File?

12. HELP: Passing a command line from a second instance of an app to the previous instance

 

 
Powered by phpBB® Forum Software