Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
At my wit's end with macro
Hello,
Hopefully someone can rescue me before I jump off the bridge. I am attempting to create a macro that finds all occurences of a specific style ("Business Rule") in a table and highlights them. Once they are highlighted, I would like the macro to then shade the cells. Here is what I have but when I run it, absolutely nothing is changed so I don't even know if the macro runs. Is there anyone who can save me before it's too late? Dim oCell As Cell Dim sTextToFind As String If Selection.Information(wdWithInTable) = False Then MsgBox "Cursor is not currently in a table" Else Selection.Find.ClearFormatting Selection.Find.Style = ActiveDocument.Styles("Business Rule") Selection.Find.ParagraphFormat.Borders.Shadow = False With Selection.Find .Text = "" .Replacement.Text = "" .Forward = True .Wrap = wdFindContinue .Format = True Do While Selection.Find.Execute = True Selection.EndKey With Selection.Cells.Shading .Texture = wdTextureNone .ForegroundPatternColor = wdColorAutomatic .BackgroundPatternColor = wdColorGray25 End With Loop End With End If End Sub |
#2
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
At my wit's end with macro
I posted this to the wrong board so I am reposting in the programming section.
"Kimm" wrote: Hello, Hopefully someone can rescue me before I jump off the bridge. I am attempting to create a macro that finds all occurences of a specific style ("Business Rule") in a table and highlights them. Once they are highlighted, I would like the macro to then shade the cells. Here is what I have but when I run it, absolutely nothing is changed so I don't even know if the macro runs. Is there anyone who can save me before it's too late? Dim oCell As Cell Dim sTextToFind As String If Selection.Information(wdWithInTable) = False Then MsgBox "Cursor is not currently in a table" Else Selection.Find.ClearFormatting Selection.Find.Style = ActiveDocument.Styles("Business Rule") Selection.Find.ParagraphFormat.Borders.Shadow = False With Selection.Find .Text = "" .Replacement.Text = "" .Forward = True .Wrap = wdFindContinue .Format = True Do While Selection.Find.Execute = True Selection.EndKey With Selection.Cells.Shading .Texture = wdTextureNone .ForegroundPatternColor = wdColorAutomatic .BackgroundPatternColor = wdColorGray25 End With Loop End With End If End Sub |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
macro produces error message | Microsoft Word Help | |||
Macro Button Won't Stay on Toolbar | Microsoft Word Help | |||
Possible bug when recording a Word Macro | Microsoft Word Help | |||
Save As is not working due to macro security settings | Microsoft Word Help | |||
2000 to 2002 macro and "Could not open macro storage" | Mailmerge |