Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
ID
Top
Expand Minimize

Path Property

Visual Studio .NET 2003

Returns the path, without filename, for the directory containing the document.

[Visual Basic .NET]
Public ReadOnly Property Path() As String
[Visual Basic 6]
Property Get Path() As String
[C++]
HRESULT __stdcall get_Path(
   /* [out, retval] */ BSTR* retVal
);
[C#]
string Path {get;}
[JScript .NET]
public function get Path() : String

Remarks

The returned path does not include the filename or extension. For example, if the document is located in "C:\MsDev\Projects\MyProject\stdafx.cpp," then Path returns the string "C:\MsDev\Projects\MyProject". There is no ending backslash, unless the path is the root of a device, such as "C:\".

Example

Sub PathExample()
  Dim doc As Document
  Dim desc As String

  Set doc = DTE.ActiveDocument
  desc = "You are editing a "
  If (doc.ReadOnly) Then
    desc = desc & "read-only"
  Else
    desc = desc & "writable"
  End If
  desc = desc & " document called " & doc.Name & " located at " & doc.Path
  MsgBox desc
End Sub

See Also

Applies To: Document Object

Show:
© 2015 Microsoft