PDA

View Full Version : Word Macro for duplex printing



danno
11-23-2006, 06:56 AM
Hi Guys

1st post here so im hoping we can get this sorted!

I have a friend who has a macro for printing documents. It allows him to tick a box and allow duplex printing from his printer! The macro works perfectly well but he wants it to be enabled CONSTANTLY by default!!

I have a very basic understanding of programming from my school A-Level project.....7 years ago and have dug out all the documentation to no avail!! Though i have managed to get the tick box ticked by changing the tick box value to TRUE. This only works though in debugging mode!! Any ideas?

The files are too large to upload so i can email them to you if need be

Thanks for your help guys

mdmackillop
11-23-2006, 11:23 AM
Hi Danno,
Welcome to VBAX.
I've always considered this is one of these areas where it's easier to cheat. Go to your Control Panel and add another copy of your printer, calling it Duplex (or similar); change the printer settings to do the Duplex printing. You then just need to run a simple macro eg


Sub Duplex()
Dim Tmp
Tmp = ActivePrinter
ActivePrinter = "Duplex"
ActiveDocument.PrintOut
ActivePrinter = Tmp
End Sub


If you need to print on different papers, record macros changing the page setup Paper Source to the appropriate trays as required.
This is my print selector userform, which simplifies life greatly.

fumei
11-23-2006, 05:20 PM
That would be the easiest way.

Some comments on the userform. Why does it have separate labels for the checkboxes? You don't need a label with the Caption "Double Sided" AND a checkbox. Why have two controls when one will do? The checkbox HAS a Caption. You can simply make the checkbox Caption "Double Sided".

I notice you have this for all the checkboxes.

Second, if you DO want to use this macro/userform, and want the checkbox value to be true, by default, then simply make it true. Do this in the Userform_Initialize event.[vba[Private Sub UserForm_Initialize()
CheckBox1.Value = True
End Sub[/vba]

Though i have managed to get the tick box ticked by changing the tick box value to TRUE. This only works though in debugging mode!!If you put it in the Initialize event, it will come up checked on the userform.

danno
12-07-2006, 03:57 AM
Well you guys obviously know you?re stuff. I have managed to make the "Double Sided" box ticked but default now by simply changing the value of the box to TRUE @ the bottom of BSLPrint Module

UserForm2.hpcopies = DefHPCopies
UserForm2.ppcopies = DefPPCopies
UserForm2.mancopies = Defmancopies
UserForm2.currentprn = ActivePrinter
UserForm2.numpages = "All"
UserForm2.CheckBox1.Value = True
UserForm2.Show
End Sub

but when i click on print it comes up with "Error Detected in Macro - Invalid procedure call or argument", BUT if i untick the "DOUBLE SIDED" it prints fine!

Now i have a sneaky suspicions that i have missed a trick maybe due to the fact it defaults to being ticked but can i find it?!?! CAN I HELL.

More infinite wisdom would be the best Christmas present i could hope for

danno

mdmackillop
12-07-2006, 05:16 AM
Can you post a copy of your code and userform? Use Manage attachments in the Go Advanced section. (You'll have to zip for file)

fumei
12-07-2006, 06:00 AM
Yes, if you have made changes, we need to see what those are.

BTW: I notice in the code you did post that you are making instructions regarding the userform BEFORE showing it. This may work, but I think it would be better to have things like checking the checkbox as TRUE within the Userform_Initialize event, rather than the module that calls the userform.

danno
12-12-2006, 04:12 AM
Here we are guys. Theres a copy of the whole Macro, iv tried it on my PC and on the users site where the original works fine! Im baffled and puzzled and baffled!

You input would be much appreciated

vipul92750
06-19-2012, 04:49 AM
Hi,
Can you please send me the code of duplex printing?

Hi Guys

1st post here so im hoping we can get this sorted!

I have a friend who has a macro for printing documents. It allows him to tick a box and allow duplex printing from his printer! The macro works perfectly well but he wants it to be enabled CONSTANTLY by default!!

I have a very basic understanding of programming from my school A-Level project.....7 years ago and have dug out all the documentation to no avail!! Though i have managed to get the tick box ticked by changing the tick box value to TRUE. This only works though in debugging mode!! Any ideas?

The files are too large to upload so i can email them to you if need be

Thanks for your help guys