Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.basic.visual.misc > #534
| From | Deanna Earley <dee.earley@icode.co.uk> |
|---|---|
| Newsgroups | comp.lang.basic.visual.misc |
| Subject | Re: 3 questions from an new oldbie |
| Date | 2011-11-30 09:23 +0000 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <jb4sn5$urc$1@speranza.aioe.org> (permalink) |
| References | <7a6380d8-b02a-4ece-a2fd-f934a00e9145@h3g2000yqa.googlegroups.com> |
On 29/11/2011 20:32, John L. wrote:
> I am trying to instanciate a Visual Basic Class Module called
> "myClass" in a Word 2003 VB macro. I have tried the following:
>
> dim a As myClass
> Set a = CreateObject("Word.Application.myClass")
> &
> Set a = CreateObject("Project.myClass")
> &
> Set a = CreateObject("Word.myClass")
>
> All failed with the same run-time error (429 : ActiveX component can't
> create object). What is the correct invocation?
If the class is in the VBA project, then CreateObject is not suitable as
that goes to registered COM objects.
You want simply:
Set a = New myClass
> Is the object saved in the document once created, or destroyed once
> the variable is out of scope?
The class is saved, the instance of the object will "disappear" as soon
as it's no longer referenced or the code/project exits.
> How do I trap an error returned if GetObject doesn't find the
> object?
On Error ....
--
Dee Earley (dee.earley@icode.co.uk)
i-Catcher Development Team
http://www.icode.co.uk/icatcher/
iCode Systems
(Replies direct to my email address will be ignored.
Please reply to the group.)
Back to comp.lang.basic.visual.misc | Previous | Next — Previous in thread | Find similar
3 questions from an new oldbie "John L." <johnlarew@sbcglobal.net> - 2011-11-29 12:32 -0800 Re: 3 questions from an new oldbie ralph <nt_consulting64@yahoo.net> - 2011-11-29 15:03 -0600 Re: 3 questions from an new oldbie Deanna Earley <dee.earley@icode.co.uk> - 2011-11-30 09:23 +0000
csiph-web