Quantcast
Channel: OKWAVE 最新質問(Visual Basic/257)【本日】
Viewing all articles
Browse latest Browse all 6510

メッセージBOXの「はい」「いいえ」の処理について

$
0
0
お世話になっております。 エクセルマクロで処理を行うときに メッセージBOXにて「はい」か「いいえ」のボタンを押して 実行か中断の処理を行なっていたいのですが、 「いいえ」を押しても処理が実行されてしまいます。 以下で作成しております。 Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) Sub IP呼び出し() Dim keizoku As Integer Dim rc As Long rc = MsgBox("処理を続けますか?", vbYesNo + vbQuestion) If rc = vbYes Then MsgBox "処理を続けます", vbInformation Else MsgBox "処理を中止します", vbCritical End If Dim Wsh, wExec, cmd, rRes, i, j Dim sBuf() As String Set Wsh = CreateObject("WScript.Shell") For i = 2 To Cells(Rows.Count, 3).End(xlUp).Row Set wExec = Wsh.exec("%ComSpec% /c nslookup " & Cells(i, 3)) Do While wExec.Status = 0 DoEvents Loop Sleep 1 rRes = wExec.StdOut.ReadAll 'MsgBox rRes sBuf = Split(rRes, vbCrLf) For j = 0 To UBound(sBuf) If Left(sBuf(j), 5) = "Name:" Or Left(sBuf(j), 3) = "名前:" Then Cells(i, 18) = Trim(Right(sBuf(j), Len(sBuf(j)) - 5)) End If Next j Next i MsgBox "ドメインを確認して下さい。", vbOKOnly, "マクロが終了しました" End Sub Excel2010で行なっております。 ご教授の程、よろしくお願いいたします。

Viewing all articles
Browse latest Browse all 6510

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>