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
Rob - 30 Mar 2007 13:18 GMT
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?