Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Macro to select all text boxes in file

Status
Not open for further replies.

richiwatts

Technical User
Jun 21, 2002
180
GB
Can anyone help me with a macro that selects all text boxes in a file. I need to change the font in all the text boxes and it is taking ages selecting them one-by-one

Thanks for your help

Richi
 
What application?

[tt]-John[/tt]
________________________
To get the best answers fast, please read faq181-2886
 
what application is definitley needed.

Also, if it is Word, you may want to consider using Styles to do this, rather than changing the textboxes font manually.

Gerry
 
Sorry, Richi, I don't do Word. But I beleive Gerry (fumei) does....

[tt]-John[/tt]
________________________
To get the best answers fast, please read faq181-2886
 
OK, what kind of textboxes. there are three (3) - sort of - textboxes in Word.

FormField text boxes - using the Forms toolbar
ActiveX textboxes - using the Controls toolbar
Those horrid Insert > Textbox things. I hope they are not them, as I dislike them immensely.

Once I know which you are using, I should be able to tell you how to get them fairly easily.

However, again, you may want to consider using Styles. Word is designed for Styles.

Essentially:

FormFields can be grouped directly from the FormField collection. You simply run through the collection, and if the object is Type 70 (a text formfield) you select it and format it. If the formfield in the collection is NOT type 70 (71 = checkbox 83, = dropdown...go figure the numbering...) then ignore it.

ActiveX are trickier, as you have to check the type, but to do so you must make a very specific reference using OLEFormat.Object.

Those horrid Insert > Textbox are Shapes - unless they have been converted to InlineShapes. Selecting them and changing the font is a nightmare in VBA.

What textboxes are you using?

Gerry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top