Hi!
I hvae a marcro that finds heading 1 in a document and inserts a particular style on the line over the heading. This works ok in word97, vut in word2000 nothing happens...
example:
before the macro is run:
Heading1
some text (Normal)
some text (normal)
after the macro is run:
Style1
heading1
some text (Normal)
some text (Normal)
Can anyone help me to solve this problem?
Is there a tool for converting a '97 macro to a '2000 macro?
Here's the code:
Thanx in advance!
Pål Nesteby
PDC-Tangen
Norway
I hvae a marcro that finds heading 1 in a document and inserts a particular style on the line over the heading. This works ok in word97, vut in word2000 nothing happens...
example:
before the macro is run:
Heading1
some text (Normal)
some text (normal)
after the macro is run:
Style1
heading1
some text (Normal)
some text (Normal)
Can anyone help me to solve this problem?
Is there a tool for converting a '97 macro to a '2000 macro?
Here's the code:
Code:
Selection.Find.ClearFormatting
With Selection.Find
.Text = ""
.Replacement.Text = "^c^&"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.TypeParagraph
Selection.MoveUp Unit:=wdLine, Count:=1
Selection.Style = ActiveDocument.Styles("Style1")
Selection.MoveRight Unit:=wdCharacter, Count:=1, Extend:=wdExtend
Selection.Copy
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Find.ClearFormatting
Selection.Find.Style = ActiveDocument.Styles("Heading 1")
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = ""
.Replacement.Text = "^c^&"
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub
Pål Nesteby
PDC-Tangen
Norway