View Single Post
Old 02-16-10, 02:10 PM   #316
karamazovnew
The Old Man
 
Join Date: Mar 2009
Location: Bucharest, Romania
Posts: 1,403
Downloads: 151
Uploads: 0


Default

BTW, for those who downloaded my tool kit, I've just found that the Word template document no longer had a macro attached. Not sure why, luckily I had posted the macro on another thread so here it is:

All you need to do is create a form with a textbox (txtPage) and a button (btnRenumber). This is all the code you need:

Quote:
Private Sub btnRenumber_Click()
Dim iItem As Integer
Dim myRange As Range
If txtPage.Value = vbNullString Then
MsgBox "You must enter the Menu Page"
ElseIf Application.Documents.Count < 1 Then
MsgBox "No document Opened"
Else
iItem = 1
Set myRange = ActiveDocument.Range(Start:=0, End:=ActiveDocument.Content.End)
myRange.Select
With Selection.Find
.Forward = True
.Wrap = wdFindStop
.Text = "[" + txtPage.Value + " I"
Do While .Execute
Selection.Extend
Selection.Extend
Selection.Extend
Selection.TypeText Text:="[" + UCase(txtPage.Value) + " I" + CStr(iItem) + "]"
iItem = iItem + 1
Set myRange = ActiveDocument.Range(Start:=Selection.End, End:=ActiveDocument.Content.End)
myRange.Select
Loop
End With
End If
End Sub
To use it, just type the name of the menu page you want to renumber. For example: G26. Note that you must make sure that all new items in that page begin with G26.

Good:
Quote:
[G26 I235]
[G26 I245]
[G26 I90]
BAD:
Quote:
[G26 I235]
[G25 I245]
[G26 I90]
karamazovnew is offline   Reply With Quote