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

loop through entire document to remove all borders

Status
Not open for further replies.

lemonhalls

Technical User
Jun 11, 2004
52
CA
I have a document with many textboxes with borders.
I would like to know how to loop thru the entire document and remove all the borders off all the objects.

Please advice.

thanks

_______________________________________________________
Sub removeBorders()
'
' removeBorders Macro
' Macro recorded 2/18/2005
'
Selection.TypeText Text:=vbTab & vbTab
Selection.MoveLeft Unit:=wdCharacter, Count:=2
Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
With Selection.InlineShapes(1)
.Borders(wdBorderLeft).LineStyle = wdLineStyleNone
.Borders(wdBorderRight).LineStyle = wdLineStyleNone
.Borders(wdBorderTop).LineStyle = wdLineStyleNone
.Borders(wdBorderBottom).LineStyle = wdLineStyleNone
.Borders.Shadow = False
End With
With Options
.DefaultBorderLineStyle = wdLineStyleSingle
.DefaultBorderLineWidth = wdLineWidth050pt
.DefaultBorderColor = wdColorAutomatic
End With
End Sub
 
Hi lemonhalls,

Something like ..
Code:
For each shape in activedocument.inlineshapes
    shape.borders(etc...
Next

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
Excel VBA Training and more Help at VBAExpress[
 
Hi,

If all you want to do is select all shapes in the sheet and then get rid of all borders then you don't need a loop. Try this:

Code:
Set myDocument = Worksheets(1)
myDocument.Shapes.SelectAll
    Selection.ShapeRange.Fill.Solid
    Selection.ShapeRange.Fill.Transparency = 0#
    Selection.ShapeRange.Line.Weight = 0.75
    Selection.ShapeRange.Line.DashStyle = msoLineSolid
    Selection.ShapeRange.Line.Style = msoLineSingle
    Selection.ShapeRange.Line.Transparency = 0#
    Selection.ShapeRange.Line.Visible = msoFalse
Range("A1").Select

Hope it helps

Shippwreck

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top