Click here to Skip to main content
12,826,806 members (46,303 online)
Click here to Skip to main content
Add your own
alternative version


8 bookmarked
Posted 10 Aug 2001

Reorder Resource ID Macro

, 10 Aug 2001 CPOL
Rate this:
Please Sign up or sign in to vote.
This simple macro helps to Reorder Resource ID in resource.h


Visual C++ project contains a symbol definition file - named "resource.h" which contains #define directives for each of the symbols used in the project. When you copy some resource from another project to your work project, you may get dup resource id definition - two symbols have the same value.

I wrote this simple macro to reorder the Resource ID in 5 minutes, it works for me. I hope you will find it useful as well.

The Macro Code

Sub ReorderResource()
	Dim objTheDocument
	Dim sSelectedText
	set objTheDocument = ActiveDocument
	Dim nNumber
	Dim nCount
	if objTheDocument.Name <> "resource.h" then
		MsgBox "This macro only working for resource.h"
		exit sub
	end if
	objTheDocument.Selection.FindText ("#define")
		objTheDocument.Selection.WordRight dsExtend
		objTheDocument.Selection.WordRight dsExtend
		if objTheDocument.Selection.Text <> "#define " then
			exit do
		end if
		objTheDocument.Selection.WordLeft dsExtend
		nNumber = int(objTheDocument.Selection.Text)
		if nCount < nNumber then
			nCount = nNumber
		end if
		objTheDocument.Selection.Text = "" & nCount
		nCount = nCount + 1
End Sub


  • 10th August, 2001: Initial post


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Roy Luo
Web Developer
China China
No Biography provided

You may also be interested in...


Comments and Discussions

GeneralMy version Pin
Philippe Lhoste10-Sep-01 3:05
memberPhilippe Lhoste10-Sep-01 3:05 
GeneralID_ vs IDC_ Pin
DanG23-Aug-01 16:35
memberDanG23-Aug-01 16:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.170326.1 | Last Updated 11 Aug 2001
Article Copyright 2001 by Roy Luo
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid