Macro To Switch Between Header and Cpp File

This is a simple macro to allow you to switch between the header and cpp file.


Sub Jump()
'////////////////////////////////////////////
'Nooruddin Kapasi 1998.
'DESCRIPTION: Switch Between Header and cpp
'////////////////////////////////////////////
Dim myDocument
Dim a
Dim b
Dim Flag
Dim Flag1
Flag1 = 0
Flag = 1
a = ActiveDocument.FullName
tmp = InStr(a, ".cpp")
If tmp Then
        b = Left(a, Len(a) - 3) + "h"
        Flag1 = 1
Else
tmp = InStr(a, ".h")
If tmp Then
        b = Left(a, Len(a) - 1) + "cpp"
        Flag1 = 1
End If
End If
For Each myDocument In Application.Documents
    If myDocument.FullName = b Then
        myDocument.Active = True
        Flag = 0
        Exit For
        End If
Next
If Flag And Flag1 Then
        Documents.Open b, "Text"
End If
End Sub



Comments

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Hurricane Sandy was one of the most destructive natural disasters that the United States has ever experienced. Read this success story to learn how Datto protected its partners and their customers with proactive business continuity planning, heroic employee efforts, and the right mix of technology and support. With storm surges over 12 feet, winds that exceeded 90 mph, and a diameter spanning more than 900 miles, Sandy resulted in power outages to approximately 7.5 million people, and caused an estimated $50 …

  • Live Event Date: May 6, 2014 @ 1:00 p.m. ET / 10:00 a.m. PT While you likely have very good reasons for remaining on WinXP after end of support -- an estimated 20-30% of worldwide devices still are -- the bottom line is your security risk is now significant. In the absence of security patches, attackers will certainly turn their attention to this new opportunity. Join Lumension Vice President Paul Zimski in this one-hour webcast to discuss risk and, more importantly, 5 pragmatic risk mitigation techniques …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds