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

Find Style and remove table border? VBA 1

Status
Not open for further replies.

nikka

Instructor
Mar 11, 2001
36
ZA
I would like to find the following style : "Table Body Text"
Which is in a table.
Once I find the table I would like the border which surronds the text to be removed.

Please help as I am not having success with this.


Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
Selection.Find.Style = ActiveDocument.Styles("Table Body Text")

Thanks Nikka
 
Hi nikka,

Have you tried recording yourself doing it? All that you have so far is part of the setting up process for the Find. If you record the Find, you will get something like this ..

Code:
[blue]    Selection.Find.ClearFormatting
    Selection.Find.Style = ActiveDocument.Styles("Table Body Text")
    With Selection.Find
        .Text = ""
        .Replacement.Text = ""
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute[/blue]

After the Execute, you should check [blue]Selection.Find.Found[/blue] to make sure the Find has been successful, and then add code to remove the borders, which can again be got by recording yourself doing it.

I don't know what sort of borders you have or want to remove (paragraph, cell, table) so can't say for sure how to proceed further. Also, can you guarantee the Find will be in a Table if it succeeds, or is a further check required? If you get stuck, if you post your recorded code, someone will help further.

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
 
Thanks Tony,

It is the execute that always catches me!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top