打印作业完成后弹出消息框

时间:2018-02-08 11:46:39

标签: excel vba excel-vba

我使用excel VBA我有代码打印excel表但问题是我想在打印作业完成后显示消息框,所以我将开始下一个打印过程。

我有以下代码:

 xlshtSal.Activate
    Dim i, totalRows, MidCount As Long
    i = 2
    'xlapp.Visible = False
    Do While xlshtInput.Cells(i, 1) <> "" Or xlshtInput.Cells(i, 1) <> Null

        xlshtSal.Range("C12") = xlshtInput.Cells(i, 1)
        xlshtSal.PrintOut
        xlshtSal.Range("C12") = ""

        i = i + 1
    Loop

   'here I want Messagebox 

    If MsgBox("Column 'A' print is completed now printing Column 'B' ? ", vbYesNo + vbQuestion, "Print wizard") = vbYes Then
        i = 2
        Do While xlshtInput.Cells(i, 2) <> "" Or xlshtInput.Cells(i, 2) <> Null

            xlshtSal.Range("C12") = xlshtInput.Cells(i, 2)
            xlshtSal.PrintOut
            xlshtSal.Range("C12") = ""

            i = i + 1
        Loop
    Else
        MsgBox "sorry, Column B is Not printed", vbExclamation
    End If

0 个答案:

没有答案