How do I customise the action of a toolbar?

Z

zirac

I'm trying to create a toolbar that will print a document on a plain paper
and the other on letterhead.

We already have this toolbar on our templates and it did worked. But since
we changed to a new printer, it will all print to a letterhead paper.

We are using MS office 2003.
 
J

Jean-Guy Marcil

zirac was telling us:
zirac nous racontait que :
I'm trying to create a toolbar that will print a document on a plain
paper and the other on letterhead.

We already have this toolbar on our templates and it did worked. But
since we changed to a new printer, it will all print to a letterhead
paper.

We are using MS office 2003.

Every printer has different paper tray numbers...
So when you changed the printer, the old code does not refer to the
appropriate tray anymore.

For more on all about VBA printing, see (especially the first topic in your
case):

Controlling the Printer from Word VBA
Part 1: Using VBA to Select the Paper Tray
http://pubs.logicalexpressions.com/Pub0009/LPMArticle.asp?ID=101

Controlling the Printer from Word VBA
Part 2: Using VBA to control Duplex, Color Mode and Print Quality
http://pubs.logicalexpressions.com/Pub0009/LPMArticle.asp?ID=116

Controlling the Printer from Word VBA
Part 3: Dealing with Different Paper Sizes
http://pubs.logicalexpressions.com/Pub0009/LPMArticle.asp?ID=132

Controlling the Printer from Word VBA
Part 4: Getting printer driver details
http://pubs.logicalexpressions.com/Pub0009/LPMArticle.asp?ID=183

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
Z

zirac

I did try the Part 1 but since I am not really familiar with VB I was not
able to get the values. I "copy and paste" the codes on a new module then
run the program and got a syntax error. Will you please direct me to the
correct direction or a more detailed step is appreciated.
 
J

Jean-Guy Marcil

zirac was telling us:
zirac nous racontait que :
I did try the Part 1 but since I am not really familiar with VB I was
not able to get the values. I "copy and paste" the codes on a new
module then run the program and got a syntax error. Will you please
direct me to the correct direction or a more detailed step is
appreciated.

Open a blank document in Word,
Make sure the target printer is set as being the active one,
Create a VBA module and paste Jonathan's code from Part 1 in the article
series I refer you to,
Add this sub at the end of the code:

'_______________________________________
Sub GetPrinterBinInfo()

Dim i As Long
Dim arrNames() As Variant
Dim arrNumbers() As Integer

arrNames() = GetBinNames
arrNumbers() = GetBinNumbers

For i = 0 To UBound(GetBinNumbers)
Selection.TypeText "Bin #" & i + 1 & ": " & arrNames(i) _
& " - Number " & arrNumbers(i) & vbCrLf
Next

End Sub
'_______________________________________

Now run the Sub.

Your previously blank document should now list the paper bins (their names
and numbers) for the currently active printer.

Now go into your old code, change the bin numbers according to the ones you
want that code to use.

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top