Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / April 2007

Tip: Looking for answers? Try searching our database.

run time error 75 while giving a name to a newly created form

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Yann - 30 Mar 2007 11:58 GMT
I want to create a userform by vba (word 2000)

here is the code :
(cut and paste 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 ?
Doug Robbins - Word MVP - 30 Mar 2007 19:49 GMT
It works fine in Word 2007.

I will try in my office on Monday on Word 2000.

Signature

Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

>I want to create a userform by vba (word 2000)
>
[quoted text clipped - 16 lines]
>
> any idea ?
Jean-Guy Marcil - 30 Mar 2007 22:20 GMT
Yann was telling us:
Yann nous racontait que :

> I want to create a userform by vba (word 2000)
>
[quoted text clipped - 16 lines]
>
> any idea ?

Did you get the error when executing step by step or when executing
normally? Some code cannot be executed step by step, like the userform
naming code, but it runs fine if executed normally.

At least, this is what I have observed with Word 2003.

Signature

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org

Yann - 03 Apr 2007 14:01 GMT
> Yann was telling us:
> Yann nous racontait que :
[quoted text clipped - 33 lines]
> jmarcilREM...@CAPSsympatico.caTHISTOO
> Word MVP site:http://www.word.mvps.org

Hi,

I have a random behaviour : sometimes it runs (1%) and most of the
time not (99%)
effectively it never runs step by step but how are you supposed to
test what you're doing ??

with Word 2007 it crashes without raising an error number (either step
by step or launched from Macro menu) and sends a useless error report
to MS
Perry - 06 Apr 2007 11:06 GMT
Once you run your code, VBE constructor has allocated used userform names in
cache during a VBE session.
If you want to create a new userform (eventhough it is deleted physically
from the VBcomponents collection) using a previously used name in the same
VBE session, you'll see this behaviour.

Y'll have to use an enumerator to by pass this, like in below sequence.
Note: pass the incremented enumerator to the name property of yr newly
created userform.

Kindly feedback the results.

Sub BuildMyForm()
Static iEnum as integer
  Set mynewform = _
     ActiveDocument.VBProject.VBComponents.Add(vbext_ct_MSForm)
     With mynewform
        .Properties("Height") = 246
        .Properties("Width") = 616
        .name = "HelloWord_" & Cstr(iEnum)
        .Properties("Caption") = "This is a test"
     End With
End Sub

--
Krgrds,
Perry

System:
Vista/Office Ultimate
VS2005/VSTO2005 SE

>I want to create a userform by vba (word 2000)
>
[quoted text clipped - 16 lines]
>
> any idea ?
Perry - 06 Apr 2007 11:10 GMT
Don't forget to increment the enumerator in previously forwarded code:
iEnum = iEnum + 1

--
Krgrds,
Perry

System:
Vista/Office Ultimate
VS2005/VSTO2005 SE

> Once you run your code, VBE constructor has allocated used userform names
> in cache during a VBE session.
[quoted text clipped - 48 lines]
>>
>> any idea ?
Jean-Guy Marcil - 06 Apr 2007 15:37 GMT
Perry was telling us:
Perry nous racontait que :

> Once you run your code, VBE constructor has allocated used userform
> names in cache during a VBE session.
[quoted text clipped - 19 lines]
>      End With
> End Sub

Good catch Perry!

Signature

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.