Visual Studio macro: Get path of previous/next document
How to get the path of previous active document & previous/next document on tab bar?
'Get current 开发者_如何学Pythonactive document
Dim file1 As String = DTE.ActiveDocument.FullName
'Get previous active document
Dim file2 As String =
'Get previous/next document (position on tab bar)
Dim file3 As String =
Thanks.
Not sure if this is the best way to do it, but I figured out to get the previous/next document on tab bar using the following code:
Dim activeDocument As String = DTE.ActiveDocument.FullName
Dim nextDocument As String
'Get next document
Dim found As Boolean = False
Dim i As Integer
For i = 1 To DTE.Windows.Count Step 1
If DTE.Windows().Item(i).Kind = "Document" Then
If DTE.Windows().Item(i) Is DTE.ActiveWindow Then
found = True
ElseIf found Then
nextDocument = DTE.Windows().Item(i).Document.FullName
Exit For
End If
End If
Next
But not sure how to get the previous active document.
精彩评论