Th following macro opens a header file included on the current line (just like
right-click on the header file name and choosing Open filename.h).
Sub OpenHeaderFile()
DESCRIPTION: Opens a header file which is #included on the current lineActiveDocument.Selection.SelectLine
LineText = ActiveDocument.Selection
StartPos = Instr(LineText,””””) ‘find the #include “” styleIf (StartPos = 0) Then
StartPos = Instr(LineText, “<") 'find the #include <> style
End IfStartPos = StartPos + 1 ‘move to the start of the include file
LineText = Mid(LineText,StartPos)
EndPos = Instr(LineText,”.h”)’ find the .h
EndPos = EndPos + 1 ‘move to the end of the include file
FileName = Mid(LineText,1,EndPos)
PathName = ActiveDocument.Path + “”
ActiveDocument.Selection.EndOfLine ‘remove selected stuff
FullFileName = PathName+FileName
on error resume next
Documents.Open FullFileName
End Sub