0
次のコードがあり、YesNoCancel
オプションは何もしません。私は何を間違えていますか?VBA YesNoCancelが正常に動作しない
Option Explicit
Sub wwb()
'lists each book that's OPEN
Dim wb As Workbook, ws As Workbook, wd As Workbook
Set wd = ThisWorkbook
MsgBox wd.Name
Dim output As Integer
Dim msgValue
For Each wb In Application.Workbooks
If wb.Name = wd.Name Then
MsgBox "The destination WorkBook is :" & wd.Name
Else
output = MsgBox("Is " & wb.Name & " your source file to import data?", vbYesNoCancel, "Please confirm source file")
If msgValue = vbYes Then
MsgBox "test yes"
ElseIf msgValue = vbNo Then
MsgBox "test No"
ElseIf msgValue = vbCancel Then
MsgBox "Test cancel"
End If
End If
Next wb
End Sub
をチェックする必要があります。 'wb'は誰ですか? – BOB
vbはすべて開いているワークブックであり、次のように定義されているように、forループ内に一時的な名前を格納します:For Each wb Application.Workbooks –