#1
|
|||
|
|||
add a validate in the below macro
If style not exists in the document need proceed and highlight the TAG (e.g., <H1>, <H2>, etc.)
Sub TagtoStyle() Application.ScreenUpdating = False Dim rngStory As Range, StrStry As String For Each rngStory In ActiveDocument.StoryRanges With rngStory With .Find .ClearFormatting .Replacement.ClearFormatting .Text = "\<[! ]@\>" .Replacement.Text = "" .Forward = True .Wrap = wdFindStop .Format = False .MatchWildcards = True .Execute End With If .Find.Found = False Then Select Case rngStory Case wdCommentsStory: StrStry = "Comments" Case wdEndnotesStory: StrStry = "Endnotes" Case wdFootnotesStory: StrStry = "Footnotes" Case wdMainTextStory: StrStry = "Document Body" Case Else: StrStry = "" End Select If StrStry <> "" Then MsgBox "No tags found in: " & StrStry, vbExclamation End If Do While .Find.Found = True .Style = Split(Split(.Text, "<")(1), ">")(0) .Text = vbNullString .Find.Execute Loop End With Next rngStory Application.ScreenUpdating = True End Sub |
#2
|
|||
|
|||
help me anyone
help me anyone
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Validate textbox fields in VBA Form before Submit | ScottyBee | Word VBA | 5 | 03-20-2019 04:46 PM |
How to assess / validate properties of PPT? | goldscepter | PowerPoint | 2 | 08-12-2016 11:51 AM |
Spell check macro within macro button field doesn't work in one document | samuelle | Word VBA | 0 | 07-20-2016 02:27 AM |
Validate file name in attachments | Ramon Adriano | Misc | 0 | 06-23-2016 10:48 AM |
Validate the height of the text when you save (VBA) | jhpe | Word VBA | 0 | 08-22-2008 06:59 PM |