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

  • When it comes to desktops – physical or virtual – it's all about the applications. Cloud-hosted virtual desktops are growing fast because you get local data center-class security and 24x7 access with the complete personalization and flexibility of your own desktop. Organizations make five common mistakes when it comes to planning and implementing their application management strategy. This eBook tells you what they are and how to avoid them, and offers real-life case studies on customers who didn't let …

  • Ever-increasing workloads and the challenge of containing costs leave companies conflicted by the need for increased processing capacity while limiting physical expansion. Migration to HP's new generation of increased-density rack-and-blade servers can address growing demands for compute capacity while reducing costly sprawl. Sponsored by: HP and Intel® Xeon® processors Intel, the Intel logo, and Xeon Inside are trademarks of Intel Corporation in the U.S. and/or other countries. HP is the sponsor …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds