次の方法で共有


Document.Path プロパティ

更新 : 2007 年 11 月

ドキュメントが格納されているディレクトリのファイル名を含まないパスを取得します。

名前空間 :  EnvDTE
アセンブリ :  EnvDTE (EnvDTE.dll 内)

構文

'宣言
ReadOnly Property Path As String
'使用
Dim instance As Document
Dim value As String

value = instance.Path
string Path { get; }
property String^ Path {
    String^ get ();
}
function get Path () : String

プロパティ値

型 : System.String

ドキュメントが格納されているディレクトリのファイル名を含まないパスを表す文字列。

解説

返されるパスには、ファイル名も拡張子も含まれていません。たとえば、ドキュメントの場所が C:\MsDev\Projects\MyProject\stdafx.cpp の場合、Path は文字列 C:\MsDev\Projects\MyProject を返します。パスがデバイスのルートである場合は、"C:\" のように末尾に円記号が付加されますが、それ以外の場合は付加されません。

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

アクセス許可

  • 直前の呼び出し元に対する完全な信頼。このメンバは、部分的に信頼されているコードから使用することはできません。詳細については、「部分信頼コードからのライブラリの使用」を参照してください。

参照

参照

Document インターフェイス

Document メンバ

EnvDTE 名前空間