Click here to Skip to main content
15,888,527 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
When printing multiple copies of the same document in Excel to my Canon Lasershot LBP1120, it prints one page, printer stops, says printing complete, then starts again and so on.

In word it will print all pages in one continuous stream. I will write a report system print function.

What do I need to do like Excel print in the same way?
Posted
Updated 11-Apr-11 1:19am
v2
Comments
Maciej Los 11-Apr-11 16:29pm    
Check printer settings in MS Excel before you'll write printing function.
junlizhang 12-Apr-11 4:08am    
Thankful,but I want to do a print function, like I describe it ,Adopt webbrowser control achieve Continuous printing or like excel printing in that way.(printing webpage)


1 solution

OK, if you want to print documents in non-continous way in MS Word, you need function like this:

Option Explicit

Sub NonContinuosPrinting()
Dim doc As Document, iCount As Integer, sAnswer As String

On Error GoTo Err_NonContinuosPrinting

'print active document
Set doc = ActiveDocument

Err_Conversion:
'get count of copies to print
sAnswer = InputBox("Count of copies?", "Printing...", "1")
'if Cancel button was pushed, exit sub
If sAnswer = "" Then GoTo Exit_NonContinuosPrinting
'try to convert to integer value
iCount = CInt(sAnswer)
'print "step by step" as many
Do While iCount > 0
    doc.PrintOut Copies:=1
    iCount = iCount - 1
Loop

Exit_NonContinuosPrinting:
    On Error Resume Next
    Set doc = Nothing
    Exit Sub
    
Err_NonContinuosPrinting:
    Select Case Err.Number
        Case 13 'error conversion text to integer value
            MsgBox "Input numeric value or click 'Cancel' button!", vbExclamation, "Error"
            Resume Err_Conversion
        Case Else
            MsgBox Err.Description, vbExclamation, Err.Number
            Resume Exit_NonContinuosPrinting
    End Select
    
End Sub


If you save this macro in Normal template it would be accessible every time you need. But remember, antivirus applications can send you a warning message like this: "normal.dot was changed by suspicious software". To prevent this message you can write your own addin (and install). From now you can create button in right-click menu (in code) or top menu (in code or manually).
 
Share this answer
 
Comments
junlizhang 28-Jun-11 14:21pm    
thank U

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900