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

Difficulties creating Macro with Restart Numbering in Word 07 1

Status
Not open for further replies.
Jun 5, 2002
417
AU
Hi,

I have a style called "My Numbers" which I am trying to apply to selected text I select throughout a document in a Macro.

The style has numbering starting at 1, but after the first time it is used, the numbering in the document continues to increment, rather than restarting at 1 each time some text is selected, as I wish.

How do I specify either in the Style, that it resets to 1 each time it is used, or in VBA in the macro. I have been unable to locate an appropriate VBA command.

I tried recording a macro but am unable to use "Reset to 1" on the right click menu (or access the right click menu) when the "My Numbers" style has been selected in this situation.

Many thanks in advance.

Peter Moran
 
Hi,

Where's the macro?

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Hi Skip,

Thanks for the reply.

Here is the macro:
Code:
Sub FindandNumber()
'
' FindandNumber Macro
' Code to Find and Extend Selection
'
    Selection.Find.ClearFormatting
    With Selection.Find
        .Text = "^p1."
        .Replacement.Text = ""
        .Forward = True
        .Wrap = wdFindContinue
    End With
    Selection.Find.Execute
    Selection.MoveLeft Unit:=wdCharacter, Count:=1
    Selection.MoveRight Unit:=wdCharacter, Count:=1
    Selection.Extend
    Selection.Find.ClearFormatting
    With Selection.Find
        .Text = "^p^p"
        .Replacement.Text = ""
        .Forward = True
        .Wrap = wdFindAsk
    End With
    Selection.Find.Execute
    
    Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
    Selection.Style = ActiveDocument.Styles("My Numbers")
    
End Sub

After I set the style at the bottom I want to Reset the numbering to 1.

Thanks

Peter Moran
 
Hi Skip,

Thanks for the reference.

Seems I'm not the first one with problems in this area!

I have some checking out to do to get my solution

Thanks again.

Peter Moran
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top