Public Class frm_batch Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles btPath.Click Dim fd As New FolderBrowserDialog() If fd.ShowDialog() = Windows.Forms.DialogResult.OK Then tbPath.Text = fd.SelectedPath End If End Sub Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles btcalc.Click '//calc Dim di As New System.IO.DirectoryInfo(tbPath.Text) If di.Exists = False Then MsgBox("no folder") Return End If Dim files1() As System.IO.FileInfo Dim files2() As System.IO.FileInfo files1 = di.GetFiles("*.tpl", IO.SearchOption.TopDirectoryOnly) files2 = di.GetFiles("*.tplx", IO.SearchOption.TopDirectoryOnly) If files1.Length < 1 AndAlso files2.Length < 1 Then MsgBox("no file") Return End If DialogResult = Windows.Forms.DialogResult.OK End Sub Private Sub frm_Macro_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load End Sub End Class