sub Application_BeforeBuildStart() if instr (ActiveConfiguration, "Release") then IncResVersion() end if end sub Sub IncResVersion() WindowCount = Windows.Count if WindowCount <> 0 then OldActiveWindow = ActiveWindow end if DspName = left(ActiveProject.FullName, len(ActiveProject.FullName)-3)+"dsp" Application.PrintToOutputWindow "Opening : "+DspName Documents.Open DspName, "Text" IsFind=ActiveDocument.Selection.FindText(".rc", dsMatchFromStart) if IsFind=false then if WindowCount=0 then ActiveWindow.Close dsSaveChangesPrompt elseif ActiveWindow<>OldActiveWindow then ActiveWindow.Close dsSaveChangesPrompt end if MsgBox "No .RC file found in project - terminating" exit sub end if ActiveDocument.Selection.StartOfLine ActiveDocument.Selection.CharRight dsMove, 7 ActiveDocument.Selection.EndOfLine dsExtend RCName = ActiveDocument.Selection if left (RCName, 2) = ".\" then RCName = mid (RCName, 3) if WindowCount=0 then ActiveWindow.Close dsSaveChangesPrompt elseif ActiveWindow<>OldActiveWindow then ActiveWindow.Close dsSaveChangesPrompt end if IncreaseVersionInFile (RCName) if WindowCount=0 then ActiveWindow.Close dsSaveChangesPrompt elseif ActiveWindow<>OldActiveWindow then ActiveWindow.Close dsSaveChangesPrompt Windows(OldActiveWindow).Active= True end if End Sub Sub IncreaseVersionInFile (Filename) Dim strOldFileVersion Dim strNewFileVersion Dim strOldProductVersion Dim strNewProductVersion Dim strSelection Application.PrintToOutputWindow "Opening : " + Filename ' Open the given resource script. Documents.Open (Filename), "Text" Windows(Filename).Active = True ' Save backup copy of file. ActiveDocument.Save (Filename+"~") ActiveDocument.Close() Documents.Open Filename, "Text" Dim Sel Set Sel=ActiveDocument.Selection Sel.GoToLine 2 Sel.SelectLine ' Only delete our comment. if left (Sel, 3) = "//#" Then Sel.Delete else ' Insert our comment. Sel.StartOfLine end if ' Write current date/time and add newline. Sel.Text ="//# Last version auto update " + CStr(now) + vbCrLf ' Find line with FileVersion Information. ActiveDocument.Selection.FindText "FILEVERSION", dsMatchForward + dsMatchFromStart + dsMatchCase + dsMatchWord ' Move to eol and then to end of build number. ActiveDocument.Selection.EndOfLine ' Mark Build Number and store in strSelection ActiveDocument.Selection.WordLeft dsExtend, 1 Set strSelection = ActiveDocument.Selection strOldFileVersion = strSelection.Text strNewFileVersion = strOldFileVersion + 1 ' Replace file entry. strSelection.Text = strNewFileVersion ActiveDocument.Selection.FindText "PRODUCTVERSION", dsMatchForward + dsMatchFromStart + dsMatchCase + dsMatchWord ' Move to eol and then to end of build number. ActiveDocument.Selection.EndOfLine ' Mark Build Number and store in strVersion. ActiveDocument.Selection.WordLeft dsExtend, 1 Set strSelection = ActiveDocument.Selection strOldProductVersion = strSelection.Text strNewProductVersion = strOldProductVersion + 1 ' Replace the entry. strSelection.Text = strNewProductVersion ' Info block. ActiveDocument.Selection.FindText "VALUE ""FileVersion"",", dsMatchForward + dsMatchFromStart + dsMatchCase ' Move to eol and then to end of build number. ActiveDocument.Selection.EndOfLine ActiveDocument.Selection.CharLeft dsMove, 3 ' Mark Build Number and store in strVersion. ActiveDocument.Selection.WordLeft dsExtend, 1 Set strSelection = ActiveDocument.Selection strSelection.Text = strNewFileVersion ActiveDocument.Selection.FindText "VALUE ""ProductVersion"",", dsMatchForward + dsMatchFromStart + dsMatchCase ' Move to eol and then to end of build number. ActiveDocument.Selection.EndOfLine ActiveDocument.Selection.CharLeft dsMove, 3 ' Mark Build Number and store in strVersion. ActiveDocument.Selection.WordLeft dsExtend, 1 Set strSelection = ActiveDocument.Selection strSelection.Text = strNewProductVersion End SubThis is one of the more useful macros for the Visual C++ IDE, I will add this to the UT knowledge base.