×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Word Loop thru userforms.

Word Loop thru userforms.

Word Loop thru userforms.

(OP)
Is there a way to loop thru the forms in word?.
It should be simple ie.
For I = 0 To Doc.Forms.Count
code
Next

However Forms can not be fnd under ThosDocument ... or anywhere else.... smile
Can anyone help?
Thanks

Herman
Say no to macros

RE: Word Loop thru userforms.

Not so easy if you mean userform as a part of vbproject.
You need a reference to VBIDE library (Microsoft Visual Basic for Applications Extensibility). The collection: Doc.VBProject.VBComponents. VBProject is common (Word and VBIDE), VBComponents is a part of VBIDE. You need to test Type property, for userform vbext_ct_MSForm = 3.
You test VB IDE components, that are different from active (open) userforms. Due to security, you need programmatic access to VBA project.

combo

RE: Word Loop thru userforms.

(OP)
Hi Combo
Thank you for your answer, I will try that.
If you have any code in stock
I would love to see it 😀

Herman
Say no to macros

RE: Word Loop thru userforms.

>You need a reference to VBIDE library

You don't, you know (well, ok, you do if you want a predeclared vbext_ct_MSForm - but you can declare that for yourself)

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close