Identifizieren zwischen OK und Abbrechen-Schaltfläche im Eingabefeld

Hi Hi Ich muss einen Code schreiben, in dem der Benutzer, wenn er klickt, etwas in das Eingabefeld eingibt. Wenn er keinen Wert eingibt, sollte er die gleiche Frage erneut zurückwerfen. Dies habe ich bereits erreicht, aber mein Problem ist Wenn der Benutzer auf CANCEl klickt, wird erneut die gleiche Frage gestellt, während das Programm beendet werden soll. Ich bin sehr neu in VB Script

Do while x=0
strAnswer = InputBox("Please enter the file extension  *  For all files:", _
    "File Extension")
If strAnswer = "" Then
        MsgBox"You must enter an extension."

Else

        a=strAnswer
        Exit Do
    End If
Loop


intRow = 2
'strFileName = "T:\public\Madhumita\New.xls"
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
Set objWorkbook = objExcel.Workbooks.Add()
'objWorkbook.SaveAs(strFileName)
objExcel.Cells(1, 1).Value = "Folder"
objExcel.Cells(1, 2).Value = "File Name"
objStartFolder = "T:\public\Madhumita\Madhu"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(objStartFolder)
Set colFiles = objFolder.Files
If a="*" Then
For Each objFile in colFiles
objExcel.Cells(intRow, 1).Value = objfolder.Name
objExcel.Cells(intRow, 2).Value = objFile.Name
intRow = intRow + 1
Next

else

For Each objFile in colFiles
m=objFSO.GetExtensionName( objFile.Path )

If m=a Then

objExcel.Cells(intRow, 1).Value = objfolder.Name
objExcel.Cells(intRow, 2).Value = objFile.Name
intRow = intRow + 1


End If
Next
End If 
objExcel.Range("A1:B1").Select
objExcel.Selection.Font.Bold = True
objExcel.Cells.EntireColumn.AutoFit
Sub SaveAs() 
    Application.Dialogs(xlDialogSaveAs).Show 
End Sub 


objExcel.Quit
MsgBox "Done"

Antworten auf die Frage(2)

Ihre Antwort auf die Frage