| Menuへ | ||||
| 超シンプルなはがき印刷ソフトを作ってみよう | ||||
Step 12 印刷の実行 |
||||
| シートコード | ||||
| 下記のコードを追加してください Option Explicit '停止フラッグ Private StopFlag As Boolean '印刷の開始 Private Sub ExPrintStart(mode As Integer) Dim maisu As Long Dim j As Long StopFlag = False CommandButton1.Enabled = False CommandButton2.Enabled = False CommandButton3.Enabled = True DoEvents maisu = Range("D4") For j = 1 To maisu If mode = 1 Then Sheets("裏面印刷").PrintOut Else Sheets("裏面印刷").PrintPreview End If If StopFlag = True Then Exit For End If ExTimer 1 If StopFlag = True Then Exit For End If Next CommandButton1.Enabled = True CommandButton2.Enabled = True CommandButton3.Enabled = False End Sub 下記のコードに変更してください Private Sub ExPrint(mode As Integer) Dim lrow As Long Dim n As Long n = 0 If IsNumeric(Range("D4")) Then n = Range("D4") End If If n = 0 Then Beep MsgBox "印刷枚数を入力してください。" Exit Sub End If '印刷の開始処理 ExPrintReady True '印刷の開始 ExPrintStart mode '印刷の終了処理 ExPrintReady False End Sub '中止 Private Sub CommandButton3_Click() StopFlag = True End Sub |
||||
| 実行結果 | ||||
|
||||
| Topへ |
||||
| ■このサイトの内容を利用して発生した、いかなる問題にも一切の責任は負いませんのでご了承下さい。■ 当ホームページに掲載されているあらゆる内容の無許可転載・転用を禁止します。 Copyright (c) 2006 excel_ninpou All rights reserved. |
||||