Disable Print Alert

H

Herman Merman

I have a macro that prints an active worksheet

Once this code runs an alert shows up which shows that Excel i
printing as would normally be displayed, I want to disable th
"printing" alert:

I have already disabled alerts and screen updates with:

Application.DisplayAlerts = False
Application.ScreenUpdating = False

But there doesn't seem to be anything that tells Excel to turn off th
printing notification.

Is it possible to shut this off?

Thank
 
D

Dave Peterson

You can turn off all of the windows screen updates--but it this code stops,
you'll be rebooting your pc:

Option Explicit
Private Declare Function LockWindowUpdate Lib "USER32" _
(ByVal hwndLock As Long) As Long
Private Declare Function GetDesktopWindow Lib "USER32" () As Long
Sub WindowUpdating(Enabled As Boolean)

'Completely Locks the Whole Application Screen Area,
'including dialogs and the mouse.

Dim Res As Long

If Enabled Then
LockWindowUpdate 0
'Unlock screen area
Else
Res = LockWindowUpdate(GetDesktopWindow)
'Lock at desktop level
End If

End Sub

Sub testme01()
Call WindowUpdating(False)
Worksheets("Sheet1").PrintOut
Call WindowUpdating(True)
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top