Imports System Imports EnvDTE Imports EnvDTE80 Imports EnvDTE90 Imports System.Diagnostics Public Module Module1 ' change the client name "vClient" ' you can change also the name of the local file: vFileWrite Sub P4Edit() Dim vClient As String Dim vFileCurrent As String Dim vFileWrite As String Dim fs As System.IO.StreamWriter vClient = "YOUR CLIENT NAME" vFileWrite = "C:\checkOut_p4.bat" vFileCurrent = DTE.ActiveDocument.FullName() fs = System.IO.File.CreateText(vFileWrite) fs.WriteLine("set P4CLIENT=" & vClient) fs.WriteLine("p4 edit " & vFileCurrent) fs.Close() Dim vStr As String Dim vRes vStr = "Client : " & vClient & vbNewLine & vbNewLine vStr = vStr & "Check out: " & vbNewLine & vbNewLine vStr = vStr & vFileCurrent vRes = MsgBox(vStr, MsgBoxStyle.OKCancel) If vRes = vbOK Then Call Shell("cmd.exe /c " & vFileWrite) End If DTE.ActiveDocument.Activate() End Sub End Module