Thread: [Solved] Blank VBA box
View Single Post
 
Old 01-08-2016, 12:37 PM
meabhpowers meabhpowers is offline Windows 7 32bit Office 2010 32bit
Novice
 
Join Date: Jan 2016
Posts: 3
meabhpowers is on a distinguished road
Default Blank VBA box

I have created a macro that would print to a specific printer (not default) and current page only. I've created macros in the past without any problems. But when I run this I get a box displayed on the screen titled Microsoft Visual Basic for Application with white X inside a red circle and buttons for OK, Help.

This is the macro:
Sub envelope()
'
' envelope Macro
'
'
ActivePrinter = "\\JOHNSONHALL\Laser 4"
Application.PrintOut FileName:="", Range:=wdPrintCurrentPage, Item:= _
wdPrintDocumentWithMarkup, Copies:=1, Pages:="", PageType:= _
wdPrintAllPages, Collate:=True, Background:=True, PrintToFile:=False, _
PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, _
PrintZoomPaperHeight:=0
End Sub


I've also tried this macro which 'sort of' worked. This selected the printer on the 2nd try but ignored the Current Page:
Sub test()
ActiveDocument.PrintOut wdPrintCurrentPage
ActivePrinter = "\\JOHNSONHALL\Laser 4"
End Sub

There is a delay when manually selecting a printer which I suspect is part of the problem (system related). The default printer is Adobe PDF which needs to remain in place for another function. I only need WORD to change printer for hard copies.

Any thoughts?

Thanks!
Reply With Quote