Recording Print Macros

January 13, 2010 at 01:16:40
Specs: Windows XP
Hi

I'm trying to create macros to print my documents, i.e. a macro for "Headed/Copy", "Cream/Copy", "Headed Only" "Cream Only" "White Only" "All Cream" and "All White" - to save me having to individually select which tray to print to.

I used to have these macros on Word 2003, but moved over to 07 yesterday (with the person I share my office with), whilst the rest of our firm is still on 03!

I can record the macros, that's the easy part! My test pages come out fine, however when I close word, reopen it (either through our database or stand-alone), type my letter and click the "Headed/Copy" macro, it prints on anything it wants (mainly cream as that is the default tray on our printer, but sometimes white, all headed, it just does what it wants really!).

The macro template is recorded to "All Documents (normal.dotm)", and is saved as a button on the Quick Access toolbar.

I've trawled through the internet and all I can find is information on how to record the macro (the bit I can do!), yet cant find that anyone has had the problem of it not saving the information.

It's not just my computer - my room-mate's computer is having the same problem, and we are both currently selecting the trays individually, which is becoming very time consuming!

Am I just missing a really simple setting?

Please help!!

Thank you


See More: Recording Print Macros

Report •


#1
January 13, 2010 at 04:59:49
Perhaps it would help if you posted the macros for us to review. Since the macros were recorded, I'm sure they contain more code than is actually needed, but it would help if we could see/test the code.

Above the Post Reply box, you'll see the word "pre". If you click that and then paste your code between the tags, the code will retain it's current formatting and should be easier for us to read. For example, this was pasted between the pre tags:

Sub Magic_Loops()
   Loop 1 of my code
     Loop 2 of my code
        The magic happens here
        More magic happens here
     End Loop 2
   End Loop 1
End Sub

BTW, another option might be to install "separate printers" with each one set to the desired properties.

For example, at home I have one HP printer shared on my network. I "added" the printer to our systems twice, once with the properties set to B&W, and then again with the properties set to Color. Each system has it's default printer set to use the printer with the properties set to B&W to save colored ink. If we really need to print in color, we choose the Color printer.

While we are actually choosing a different printer from the printer list, this could be automated with macros. For example, at work my default printer is a fancy network printer, but I occasionally will print to a "basic" Brother laser in my office. To do this, I just click a button on my toolbar which changes the printer to the Brother, prints and then sets my default back to the original:

Sub PrintBrother()
    ActivePrinter = "Brother HL-1440 series"
    Application.PrintOut FileName:="", Range:=wdPrintAllDocument, Item:= _
        wdPrintDocumentContent, Copies:=1, Pages:="", _
         PageType:=wdPrintAllPages
      ActivePrinter = "\\my_network_path_goes_here\LASER13"
End Sub

So maybe you could combine these 2 methods:

1 - Install multiple printers with the properties set as desired.
2 - Use a button for each printer to switch to it, print and then switch back to the "default".


Report •

#2
January 13, 2010 at 06:20:29
Sub headedcopy()
'
' headedcopy Macro
'
'
    Application.PrintOut FileName:="", Range:=wdPrintCurrentPage, Item:= _
        wdPrintDocumentContent, Copies:=1, Pages:="", PageType:=wdPrintAllPages, _
        ManualDuplexPrint:=False, Collate:=True, Background:=True, PrintToFile:= _
        False, PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, _
        PrintZoomPaperHeight:=0
    Application.PrintOut FileName:="", Range:=wdPrintCurrentPage, Item:= _
        wdPrintDocumentContent, Copies:=1, Pages:="", PageType:=wdPrintAllPages, _
        ManualDuplexPrint:=False, Collate:=True, Background:=True, PrintToFile:= _
        False, PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, _
        PrintZoomPaperHeight:=0
End Sub

That's the macro for my "Headed/Copy" template.

I'll try "adding" the printer as another printer now. Thank you!


Report •

#3
January 13, 2010 at 07:13:42
First, I'd like to point out a couple of things:

Your code consists of 2 long lines of code. The underscore character ( _ ) is just a line connection character.

1 - Both of the lines of code, which begin with Application.PrintOut are exactly the same. Any idea why that is?

2 - I don't see anything in the code that tells the printer which tray to pull from. I recorded a macro on my machine while printing to Tray 3 (Tray 1 is the default) and I don't see anything in the recorded code related to which tray to use.

When I ran that code a different document, it printed from the default Tray 1.

My point here is that it does not appear that recording a print-out macro records the tray option.

I believe that that situation is indirectly explained at this site, where it says you cannot access the Print Properties of the Print Driver dialog box via VBA.

http://word.tips.net/Pages/T001697_...

The site offers some code that might work, but it also (coincidentally!) suggests the exact method I mentioned earlier about setting up different printers and choosing the printer (not the tray)through a macro.

I swear I came up with that solution on my own! :-)


Report •

Related Solutions

#4
January 13, 2010 at 07:51:23
I can't work out why both lines are the same, and neither mention which tray to pull from - it really doesn't make any sense to me!

Tray 1 = Cream (default)
Tray 2 = White
Tray 3 = Headed.

I expected it to say somewhere in there something about the trays! The first line should be the recording of the Headed print, and the second line should be the recording of the White print, however neither trays are mentioned.

I'm amazed print macros were so simple to create in Office 03, yet so confusing in 07!

I haven't had chance yet to set up "different" printers - but will give that a go asap.

Thank you for trying though!!!


Report •

#5
January 13, 2010 at 08:18:05
re: I'm amazed print macros were so simple to create in Office 03, yet so confusing in 07!

You may have missed one of the points I was trying to make.

I recorded my print macro in Office 03 and there is no mention of the tray in the recorded code.

I don't know how you created the macros when you had 03, but I don't see how you could have recorded them and had them choose a specific tray.


Report •

#6
January 13, 2010 at 09:01:40
Hi,

Are you able to access the macros you used in Word 2003. If so could you post them.

Macros from Word 2003 work in Word 2007 (I can't say ALL macros work, but I have several which work as they did in Word 2003).

Could you transfer the working macros rather than create new.

Regards


Report •


Ask Question