Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / April 2008

Tip: Looking for answers? Try searching our database.

COM objects

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
DavidY - 25 Apr 2008 16:15 GMT
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.
Klatuu - 25 Apr 2008 17:28 GMT
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.
Signature

Dave Hargis, Microsoft Access MVP

> 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
[quoted text clipped - 11 lines]
>
> Thanks.
DavidY - 25 Apr 2008 18:29 GMT
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.

> COM is now called Automation.
> I really don't have any depth of experience with VB6, but with VBA you need
[quoted text clipped - 16 lines]
> >
> > Thanks.
DavidY - 25 Apr 2008 18:33 GMT
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.

> 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
[quoted text clipped - 20 lines]
> > >
> > > Thanks.
Robert Morley - 25 Apr 2008 18:50 GMT
> 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
DavidY - 25 Apr 2008 22:01 GMT
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.

> > Nope, that still didn't work.
>
[quoted text clipped - 21 lines]
>
> Rob
DavidY - 25 Apr 2008 18:38 GMT
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.

> 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
[quoted text clipped - 20 lines]
> > >
> > > Thanks.
Klatuu - 25 Apr 2008 19:22 GMT
Are you running this from a VB6 project, or in .net ?
Signature

Dave Hargis, Microsoft Access MVP

> 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
[quoted text clipped - 24 lines]
> > > >
> > > > Thanks.
DavidY - 25 Apr 2008 22:02 GMT
The object was created with VB6 and is running in a .dll called from a form
on an Access 2002 database.

> Are you running this from a VB6 project, or in .net ?
>
[quoted text clipped - 26 lines]
> > > > >
> > > > > Thanks.
Klatuu - 25 Apr 2008 22:09 GMT
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.
Signature

Dave Hargis, Microsoft Access MVP

> The object was created with VB6 and is running in a .dll called from a form
> on an Access 2002 database.
[quoted text clipped - 29 lines]
> > > > > >
> > > > > > Thanks.
DavidY - 25 Apr 2008 22:26 GMT
Okay, thanks for your help. I'm going to try recompiling the project on the
new XP machine and see if that helps.

> Sorry, I don't really know what the problem is.
> My only thought is that it may not be compatible with VBA.  There are
[quoted text clipped - 34 lines]
> > > > > > >
> > > > > > > Thanks.
Klatuu - 25 Apr 2008 22:31 GMT
Good Luck.
Signature

Dave Hargis, Microsoft Access MVP

> Okay, thanks for your help. I'm going to try recompiling the project on the
> new XP machine and see if that helps.
[quoted text clipped - 37 lines]
> > > > > > > >
> > > > > > > > Thanks.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.