Sub SourceHeaderJumper() 'splitted file name Dim SArr As System.Array 'new filename generated by macros Dim NewFN AsString 'file name base (without extention) Dim FNBase AsString 'file extention Dim Ext AsString 'simple counter Dim i AsInteger If DTE.ActiveDocument() IsNothingThen ExitSub EndIf SArr = DTE.ActiveDocument().Name().Split(".") 'has file extention? If (SArr.GetLength(0) <2) Then ExitSub EndIf 'file name base FNBase = DTE.ActiveDocument().Path() For i =0To SArr.GetLength(0) -2 FNBase = FNBase + SArr(i) +"." Next 'file extention Ext = System.Convert.ToString(SArr(SArr.GetLength(0) -1)).ToLower() 'business logic If (Ext ="cpp") Or (Ext ="c") Then NewFN = FNBase +"h" Else If Ext ="h"Then NewFN = FNBase +"cpp" IfNot System.IO.File.Exists(NewFN) Then NewFN = FNBase +"c" EndIf EndIf EndIf 'if you don't want add file to tabs uncomment next line 'DTE.ActiveDocument().Close() 'opens needed file If System.IO.File.Exists(NewFN) Then DTE.ItemOperations.OpenFile(NewFN) EndIf End Sub