runtime error 75 when trying to give a name to a form

Y

Yann

I want to create a userform by vba (word 2000)

here is the code :
(cut and pasted from http://support.microsoft.com/kb/204330/en)
I get a runtime error 75 when it reach the .name="Helloworld" line
(everything else works fine, the form is created, the caption and the
dimensions are correctly set when the .name line is skipped)

Sub BuildMyForm()
Set mynewform = _
ActiveDocument.VBProject.VBComponents.Add(vbext_ct_MSForm)
With mynewform
.Properties("Height") = 246
.Properties("Width") = 616
.name = "HelloWord"
.Properties("Caption") = "This is a test"
End With
End Sub

any idea ?
many thanks in advance
 
R

Rob

Typical of Microsoft to post code without any dimensioned variables. With
Word 2003, once I add the reference and dimension mynewform (as a variant
because I didn't feel like sorting though every type to get the right one) I
get no errors with that code. Are you sure you added the reference to
Microsoft Visual Basic for Applications Extensibility library?
 

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