Excel Bug when controlled by Visual Basic? 
Author Message
 Excel Bug when controlled by Visual Basic?

Can someone please help me i am in a bit of a time crunch as my deadline was
last tuesday!!

I am using Visual Basic 6.0 enterprise to create an excel 2000 spreadsheet
from a premade template, then put data into that spreadsheet from a user
generated file.

There is absolutely NO problem when using Win 2000, or WinXP. But when i try
to run this program on Win98, Win98Se, or WinXP in compatability with
Win98/ME. I get an Automation error. Here is the exact text

Run-time error '-2147417848(80010108)':

Automation error
The object invoked has disconnected from its clients.

I have tried to look and see in the msdn help topics but the only thing
close said to try and see if the object was not properly unreferenced.
unfortunately, this is the FIRST time in the application that i reference
this item

here is the code that crashes it

in the declarations section
Public xl as Excel.Application
Private WithEvents xls as Excel.Application

In the forms Load Section
Set xl = CreateObject("Excel.Application")
set xls = xl
xl.workbooks.Open frmStartup.PropToOpen 'Proposal File to open from the
frmStartup public string PropToOpen

the next to last line is where i get the crash from, don't understand why i
get this error

PLEAZE help.

Thanks in advance

Thomas Anderson
Technical Coordinator
Cabinets 2000, Inc.

If you know how to fix this




Fri, 08 Oct 2004 22:42:11 GMT  
 Excel Bug when controlled by Visual Basic?
I think it may have something to do with your method of Dim'ming. While
writing an app to work with Excel a few months ago, I learned that there was
more than one way to do things. Here is how I did it. My code worked on Win
98, 98 SE, and 2000 with no problems. I was using VB6 Enterprise with Excel
2000 as well.

Dim Excel As Excel.Application  ' Excel Object
Dim ExcelWB As Excel.Workbook   ' Excel Workbook
    Set Excel = CreateObject("Excel.Application")   ' Create Excel Object
    Set ExcelWB = Excel.Workbooks.Open(variable_holding_filename)
' Actually open the .xls

So stuff in here to the file. When you are finished BE SURE to do the
following:

    Excel.Workbooks.Close
    Set ExcelWB = Nothing: Set Excel = Nothing

HTH,
Andy


Quote:
> Can someone please help me i am in a bit of a time crunch as my deadline
was
> last tuesday!!

> I am using Visual Basic 6.0 enterprise to create an excel 2000 spreadsheet
> from a premade template, then put data into that spreadsheet from a user
> generated file.

> There is absolutely NO problem when using Win 2000, or WinXP. But when i
try
> to run this program on Win98, Win98Se, or WinXP in compatability with
> Win98/ME. I get an Automation error. Here is the exact text

> Run-time error '-2147417848(80010108)':

> Automation error
> The object invoked has disconnected from its clients.

> I have tried to look and see in the msdn help topics but the only thing
> close said to try and see if the object was not properly unreferenced.
> unfortunately, this is the FIRST time in the application that i reference
> this item

> here is the code that crashes it

> in the declarations section
> Public xl as Excel.Application
> Private WithEvents xls as Excel.Application

> In the forms Load Section
> Set xl = CreateObject("Excel.Application")
> set xls = xl
> xl.workbooks.Open frmStartup.PropToOpen 'Proposal File to open from the
> frmStartup public string PropToOpen

> the next to last line is where i get the crash from, don't understand why
i
> get this error

> PLEAZE help.

> Thanks in advance

> Thomas Anderson
> Technical Coordinator
> Cabinets 2000, Inc.

> If you know how to fix this





Sun, 10 Oct 2004 17:05:11 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Bug in Excel Visual Basic - LinEst function?

2. Answer of: The 256 controls problem / a Visual Basic 5.0 bug

3. Access controlling excel workbooks with visual basic

4. Take the control of Excel via Visual Basic

5. Take the control of Excel via Visual Basic

6. Controlling Excel 5.0 from Visual Basic 4.0 via DDE

7. Using visual basic controls outside a Visual Basic application

8. Excel / excel macros created within Visual Basic

9. Use of Excel functions in visual basic functions in excel module

10. looking for conversion software for MS Excel 4.0 (ELM) to MS Excel 5.0 visual Basic

11. So - how many bugs in Visual Basic 5?

12. A Visual Basic 5.0 bug

 

 
Powered by phpBB® Forum Software