PDA

View Full Version : [SOLVED:] wdPrintCurrentPage Doesn't Work in Word 2013



calbs
06-11-2015, 04:39 PM
Hello,

I wanted to post this solution I came up with to solve a problem our business is experiencing in Word 2013 (Office 365) to help others who may be searching for this topic later. This forum frequently shows up in Google searches. Let me know what you think.


Problem: When using wdPrintCurrentPage in Word 2013 VBA, the macro would run and print the first page of the document and not the current page.

The document tested on was several pages long and no matter what page was selected it would print the first page.

Note: We have multiple network printers and part of the code is to define the appropriate printer before printing.


Original Code:


ActivePrinter = "\\network-printer-name"
ActiveDocument.PrintOut Range:=wdPrintCurrentPage


Work around / Solution Code:


Sub PrintPage()
'
' PrintPage Macro
'
'
Dim pagenum As String
pagenum = Selection.Information(wdActiveEndAdjustedPageNumber)

ActivePrinter = "\\network-printer-name"
Application.PrintOut FileName:="", Range:=wdPrintFromTo, From:=pagenum, To:=pagenum

End Sub

calbs
06-16-2015, 05:05 PM
Follow up: Looks like this is an issue due to a software patch.

Besides re-authoring the code like I did in the original post, The temporary solution to get the original macro working again is to uninstall update KB2965224 (part of the April Patch Tuesday collection). Microsoft will have to fix whatever is wrong with that patch and reissue it.

Found this bit of information from Microsoft Answers.