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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I change a text box's border properties in VBA? 1

Status
Not open for further replies.

guitareth

Technical User
May 4, 2004
2
US
I can modify a border to make it invisible by right-clicking on it, but I can't find a way to deal similarly with it in code. Everything else seems to have a border or borders property but not my text boxes. I don't want to convert them to frames because I already have them laid out the way I like and converting them totally changes things. I'd like to keep the borders while I work with it, then make the borders go away when I run my macro.
Thanx in advanx
 
Have you tried the macrorecorder ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Dunno 'bout you but when I look in the object model (that'll be F2 whilst in the VBE), I can clearly see a BorderColor and BorderStyle property of a textbox

Rgds, Geoff

"Having been erased. the document thjat you are seeking. Must now be retyped"

Please read FAQ222-2244 before you ask a question
 
app? also, depends on what u mean by "textbox"

xlbo - bordercolor and borderstyle r properties of a control or form, NOT properties of (if Word) an InLineShape or Shape. so true if "textbox" is ActiveX control, not true if used Insert > Textbox - that makes Shape object. Shape textboxes always have border. a "box" is not a box if no border.

not only that, but Insert > Textbox makes TWO Shape object, the container Shape and the "textbox" Shape inside it.

not only that, but if u make a "textbox" & delete, make another, delete that, (so now none in doc) make another...name is INCREMENT of how many were ever created. container would be Shapes("Canvas Shape 3"), and "textbox" would b Shapes("Text Box 4"). number is persistent.

can still b done via code using ShapeRange. problem is finding name. must use Select, not Range - there is NO range.

ActiveDocument.Shapes("Text Box 7").Select
Selection.ShapeRange.Line.Transparency = 1#

border now invisible
 
Thanks for the responses you guys! My first post, apologies for neglecting to mention Word97. The macro recorder wrote what I wanted: Selection.ShapeRange.Line.Visible = msoFalse.
I may have been wrong with "textbox", but borders of shapes & frames weren't getting it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top