Get Friend File

Macro that opens the corresponding .h / .cpp file (i.e. if fnurt.h is active it opens fnurt.cpp and vice verca)
and works best if used via a accelerator key (using Alt-1 myself).

Quite lo-tech but useful never the less.


Sub GetFriendFile()
‘DESCRIPTION: Opens the corresponding .h / .cpp file

currentFileName = Application.ActiveDocument.FullName
newFileName = “”

if (Ucase(Right(currentFileName,2))=”.H”) then
newFileName = Left(currentFileName,Len(currentFileName)-2)+”.CPP”
elseif (Ucase(Right(currentFileName,4))=”.CPP”) then
newFileName = Left(currentFileName,Len(currentFileName)-4)+”.H”
end if

if newFileName<>“” then Application.Documents.Open newFileName

End Sub

Date Last Updated: February 3, 1999

More by Author

Must Read