Skip to content

Instantly share code, notes, and snippets.

@fzawada
Created September 28, 2012 14:08
Show Gist options
  • Save fzawada/3800089 to your computer and use it in GitHub Desktop.
Save fzawada/3800089 to your computer and use it in GitHub Desktop.
Copies current document path to clipboard
Option Strict Off
Option Explicit Off
Imports System
Imports EnvDTE
Imports EnvDTE80
Imports EnvDTE90
Imports EnvDTE90a
Imports EnvDTE100
Imports System.Diagnostics
Imports System.Windows.Forms
Public Module RecordingModule
Private fullPathToFile As String
Sub CopyDocumentPath()
fullPathToFile = DTE.Windows.DTE.ActiveDocument.Path + _
DTE.Windows.DTE.ActiveDocument.FullName
Dim thread As New Threading.Thread(AddressOf CopyToClipboard)
thread.ApartmentState = Threading.ApartmentState.STA
thread.Start()
thread.Join()
End Sub
Private Sub CopyToClipboard()
'The second parameter is required
Clipboard.SetDataObject(fullPathToFile, True)
End Sub
End Module
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment