Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 01-26-2017, 08:26 AM
Leftovercity Leftovercity is offline Macro Code for Duplex Printing Mac OS X Macro Code for Duplex Printing Office 2016
Novice
Macro Code for Duplex Printing
 
Join Date: Jan 2017
Posts: 3
Leftovercity is on a distinguished road
Default Macro Code for Duplex Printing

Hi Everyone,

First time on here. I'm new to Macros but got one working that creates sequential numbering page to page. But now my issues is that the document I need it for is two pages and I need it to be printed two sided (Duplex). When I run the Macro it bypasses the printer setting window and prints two individual pages. Is there a Macro code I can add to run duplex printing?

Here's my current code:



Code:
Dim Message As String, Title As String, Default As String, NumCopies As Long
Dim Rng1 As Range

' Set prompt.
Message = "Enter the number of copies that you want to print"
' Set title.
Title = "Print"
' Set default.
Default = "1"

' Display message, title, and default value.
NumCopies = Val(InputBox(Message, Title, Default))
SerialNumber = System.PrivateProfileString("C:\Settings.Txt", _
"MacroSettings", "SerialNumber")

If SerialNumber = "" Then
  SerialNumber = 1
End If

Set Rng1 = ActiveDocument.Bookmarks("SerialNumber").Range
Counter = 0

While Counter < NumCopies
  Rng1.Delete
  Rng1.Text = Format(SerialNumber, "0000")
  ActiveDocument.PrintOut
  SerialNumber = SerialNumber + 1
  Counter = Counter + 1
Wend

'Save the next number back to the Settings.txt file ready for the next use.
System.PrivateProfileString("C:\Settings.txt", "MacroSettings", _
  "SerialNumber") = SerialNumber

'Recreate the bookmark ready for the next use.
With ActiveDocument.Bookmarks
  .Add Name:="SerialNumber", Range:=Rng1
End With

ActiveDocument.Save

Last edited by macropod; 01-26-2017 at 03:54 PM. Reason: Added code tags and formatting
Reply With Quote
 

Tags
duplex, macro edit



Similar Threads
Thread Thread Starter Forum Replies Last Post
Stop duplex printing NuDawn Word 0 12-28-2016 09:06 AM
Macro Code for Duplex Printing Mixed Duplex Printing jaygreg Word 2 01-29-2014 09:54 AM
Printing calendar pages with duplex cma6 Outlook 0 12-06-2012 07:29 AM
Macro Code for Duplex Printing Duplex printing fireman0174 Word 1 09-26-2011 01:44 AM
Duplex Printing a merge doc AshlandMark Word 0 02-10-2009 12:29 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:57 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft