VERSION 5.00 Begin VB.Form Form1 Caption = "フォルダの作成と削除" ClientHeight = 2220 ClientLeft = 60 ClientTop = 345 ClientWidth = 4500 LinkTopic = "Form1" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 2220 ScaleWidth = 4500 StartUpPosition = 3 'Windows の既定値 Begin VB.CommandButton Command2 Caption = "フォルダ削除" Height = 375 Left = 2400 TabIndex = 2 Top = 1200 Width = 1575 End Begin VB.CommandButton Command1 Caption = "フォルダ作成" Height = 375 Left = 480 TabIndex = 0 Top = 1200 Width = 1575 End Begin VB.Label Label2 Caption = "By MADIA" Height = 180 Left = 3360 TabIndex = 3 Top = 1800 Width = 810 End Begin VB.Label Label1 Caption = "D:\Test というフォルダを作成、又は削除するサンプルです" Height = 180 Left = 0 TabIndex = 1 Top = 600 Width = 4410 End End Attribute VB_Name = "Form1" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Private Sub Command1_Click() ' エラー処理 On Error GoTo ErrorFunction MkDir "D:\Test" MsgBox "D:\Testフォルダを作成しました!" Exit Sub ErrorFunction: MsgBox "D:\Testフォルダはすでに存在しますので作成出来ません!" End Sub Private Sub Command2_Click() ' エラー処理 On Error GoTo ErrorFunction RmDir ("D:\Test") MsgBox "D:\Testフォルダを削除しました!" Exit Sub ErrorFunction: MsgBox "D:\Testフォルダは存在しませんので削除出来ません!" End Sub