Class does not support Automation or does not support expected int

W

William

Hi,

G'd morning. In Office 2003, I created a Word template which has a word
document, VBA code, and couple of FORMs. And, I'm getting very strange error
when I change the template.

I added a new textbox, an activeX obj, to the word document, but it seemed
that the old document, created without the new textbox, didn't like the new
textbox somehow, I think.

I got the following error:
Run-time error '430':
Class does not support Automation or does not support expected interface.

the code:
ActiveDocument.txtCompanyName.text = "My Company"

txtCompanyName is the name of the textbox created before.

If I delete the newly created obj from the template, all the old documents
work fine with the code.

I don't know if there is any change in Office 2003 on how to reference
ActiveX obj. Or, I should register the objs before I reference to them in VBA
code.

Is anyone has come across this type of problem?

Thank you very much.

Will.
--
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?V2lsbGlhbQ==?=,

I'm not clear about how all these things work together, here. you have a
template. In that template you've inserted ActiveX controls, with code? Do you
also have UserForms? Or do you mean something else by "Forms"?

But what's this "document" to which you refer? Are you creating a new document
from the template, then trying to add ActiveX controls to that? Or something
else?

In which code module is the code you show us? Is ActiveDocument supposed to
refer to a document generated from the template, or the template itself? Have
you see the article on using ActiveX controls in Word, on the MSDN site? It
discusses some issue concerned with automating ActiveX controls in documents,
where the code is contained in the attached template.
G'd morning. In Office 2003, I created a Word template which has a word
document, VBA code, and couple of FORMs. And, I'm getting very strange error
when I change the template.

I added a new textbox, an activeX obj, to the word document, but it seemed
that the old document, created without the new textbox, didn't like the new
textbox somehow, I think.

I got the following error:
Run-time error '430':
Class does not support Automation or does not support expected interface.

the code:
ActiveDocument.txtCompanyName.text = "My Company"

txtCompanyName is the name of the textbox created before.

If I delete the newly created obj from the template, all the old documents
work fine with the code.

I don't know if there is any change in Office 2003 on how to reference
ActiveX obj. Or, I should register the objs before I reference to them in VBA
code.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 
W

William

Hi Cindy,

the template has couple userforms, modules with VBA code, and ActiveX
controls on the template.

all the changes are made to the template. when a user creates a new doc from
the template, the new doc will have the latest changes to VBA code or ActiveX
contols.

it seems that if i add a new activex control to the template, the old doc
without the new activex control but has a reference to the template is not
working. for example, i created a new obj called address. and, the
txtCompanyName text box obj already existed before. ActiveDocument is the doc
created from the template, and is the active document.

Thanks,

will
 

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