戻る



デスクトップのパスを取得する方法
動作環境 Windows98/2000 開発環境 Visual Basic 6.0 (+SP5)
説明 WshShell オブジェクトの SpecialFolders プロパティを利用して、デスクトップのパスを取得します。
用意するもの:標準フォーム(Form1)、コマンドボタン (Command1)


Private Sub Command1_Click()

Dim MyWSShell As Object
Dim MyDesktop As String

Set MyWSShell = CreateObject("WScript.Shell")

MyDesktop = MyWSShell.SpecialFolders("Desktop")

MsgBox MyDesktop, vbInformation, "デスクトップのパスを取得"

Set MyWSShell = Nothing

End Sub



セブンアンドワイ