Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!.POSTED!not-for-mail From: ralph Newsgroups: comp.lang.basic.visual.misc Subject: Re: 3 questions from an new oldbie Date: Tue, 29 Nov 2011 15:03:57 -0600 Organization: Aioe.org NNTP Server Lines: 38 Message-ID: References: <7a6380d8-b02a-4ece-a2fd-f934a00e9145@h3g2000yqa.googlegroups.com> NNTP-Posting-Host: 3Bid/Zl1yvkRJxJX6Le9QQ.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org X-Notice: Filtered by postfilter v. 0.8.2 X-Newsreader: Forte Agent 6.00/32.1186 Xref: x330-a1.tempe.blueboxinc.net comp.lang.basic.visual.misc:533 On Tue, 29 Nov 2011 12:32:04 -0800 (PST), "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? > >Is the object saved in the document once created, or destroyed once >the variable is out of scope? > >I also envison using the GetObject() method if the class object is >created in the document. How do I trap an error returned if GetObject >doesn't find the object? > >Thanks in advance for any help you may be able to provide. From your wording and the examples given it isn't clear to me where "myClass" resides. However, assuming myClass is published through an ActiveX component... The CreateObject function takes as its argument an AppID or ProgID which must be registered in the Registry. Look under HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AppID\{AppID_value} to see if it is registered. hth -ralph