This macro will take a selection and renumber the resource ID's in
sequential order. This comes in very handy when trying to avoid resource
conflicts as well as when trying to merge items from one resouce file
into another.
Sub AssignResourceIDToSelection ()
msg = InputBox ("Enter The resource ID to start From:")
If msg <> "" Then
If IsNumeric(msg) Then
nCurResourceID = Int(msg)
AssignGivenResourceIDToSelection(nCurResourceID)
End If
Else
MsgBox "You MUST enter a resource ID, Aborting"
End If
End Sub
Function AssignGivenResourceIDToSelection (ByVal nCurResourceID)
nStartLine = ActiveDocument.Selection.TopLine
nEndLine = ActiveDocument.Selection.BottomLine
For i = nStartLine To nEndLine
ActiveDocument.Selection.GoToLine i
ActiveDocument.Selection.FindText "#define", dsMatchForward
If ActiveDocument.Selection.CurrentLine = i Then
ActiveDocument.Selection.EndOfLine
ActiveDocument.Selection.WordLeft dsExtend
ActiveDocument.Selection = nCurResourceID
nCurResourceID = nCurResourceID + 1
End if
Next
End Function
Updated 21 March 1998