COM objects

D

DavidY

I wrote a COM object several years ago using VB6 that would query an Access
2002 database into a DAO recordset. It would then format the data in a very
specific way and then write it out to an excel.application object. This all
used to work just great and the COM object could be invoked from a form on
the database or from a field in a Word document. However I tried to run it
recently on a "newer" XP machine and it now generates and error that says
"Class does not support automation" (or something similar). I have not
installed VB on this machine yet so I have not stepped through the object to
see exactly when the error is generated but I have a feeling it's when it
tries to create the excel.application object.

Has something changed since 2004 that could affect the way this COM object
works either with Excel or something else?

Thanks.
 
K

Klatuu

COM is now called Automation.
I really don't have any depth of experience with VB6, but with VBA you need
to establish a reference the the Excel Object model before you can work with
it.
 
D

DavidY

Thanks for the reply. I did set the reference to the Excel object in VB6
where I created the Automation object. Should I also set the reference in the
VBA in Access too? I'll give that a try and see if it works.
 
D

DavidY

Nope, that still didn't work.

I have an old copy of Visual Studio .NET 2002. Can I port the code from my
VB6 project right into that and continue to develop from there?

Thanks.
 
D

DavidY

Actually I still don't understand why this object doesn't work when it used
to work just fine before. Nothing has changed with it as I am running it from
the image of the original installation CD that I created for it in 2004.
 
R

Robert Morley

DavidY said:
Nope, that still didn't work.

Just out of curiosity, you may want to try recompiling your original COM
project, in case there's some library incompatibility going on there or
something.
I have an old copy of Visual Studio .NET 2002. Can I port the code from my
VB6 project right into that and continue to develop from there?

In all honesty, I would say don't even try. The migration from VB6 to any
of the .NET versions of VB is most definitely non-trivial...in fact, in most
cases, I'd say it's anywhere between arduous to a nightmare. Most of the
people I know who've "converted" VB6 projects have found it easier simply to
start over from scratch, given then huge change in design philosophy under .NET.

Whether intentional or just through corporate blindness, Microsoft gives a
very misleading view of how "easy" it is to migrate to VB.NET...it's
anything but.

That said, .NET does have some very powerful features and the run-time
library is positively huge! If performance is a major concern for you,
however, you'll find that the performance of .NET is noticeably slower in
most instances compared to an equivalent VB6 project.



Rob
 
D

DavidY

I'll try recompiling it and see what happens. I don't have VB6 installed on
that computer so I have to do that first.

Thanks for the warning about migrating the project to VB.NET. That's what I
was afraid of.
 
K

Klatuu

Sorry, I don't really know what the problem is.
My only thought is that it may not be compatible with VBA. There are
differences between VB6 and VBA, but this is beyond my experience and
knowledge.
 
D

DavidY

Okay, thanks for your help. I'm going to try recompiling the project on the
new XP machine and see if that helps.
 
K

Klatuu

Good Luck.
--
Dave Hargis, Microsoft Access MVP


DavidY said:
Okay, thanks for your help. I'm going to try recompiling the project on the
new XP machine and see if that helps.
 

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