Call test() Sub test() Dim test test = msgbox("テストしますか?",4,"確認") If test <> 6 Then msgbox "中止します" WScript.Quit End If Dim objXL Set objXL = WScript.CreateObject("EXCEL.Application") strPath = (CreateObject("WScript.Shell").SpecialFolders("Desktop") & "\test") strPath1 = (CreateObject("WScript.Shell").SpecialFolders("Desktop") & "\test\test.xls") Set objFS = CreateObject("Scripting.FileSystemObject") If objFS.FolderExists(strPath) Then If objFS.FileExists(strPath1) Then objXL.Visible = True objXL.Workbooks.Open(CreateObject("WScript.Shell").SpecialFolders("Desktop") & "\test\test.xls") Else msgbox("「test」フォルダに「test.xls」がありません。") End If Else msgbox("デスクトップに「test」フォルダがありません。") End If End Sub