Link to home
Start Free TrialLog in
Avatar of philipeddies
philipeddies

asked on

VBA Select the paper Type using VBA

Hi,

I have set up a Marco in Word that does a few things and then prints out the page to a certain printer and to a certain tray.

This works fine but how can I select to type of paper e.g. Thick Card, at the moment my picture keeps on jamming because it thinks it is standard paper.

Any ideas
Thanks
Phil
Avatar of GrahamSkan
GrahamSkan
Flag of United Kingdom of Great Britain and Northern Ireland image

Can you do that manually in the Word printer set up? It would be a function of the printer driver. What is the printer model?
I don't know how to adjust paper thickness, but you can select the paper source like this

Sub SetTray()
    With ActiveDocument.PageSetup
        .FirstPageTray = wdPrinterLowerBin
        .OtherPagesTray = wdPrinterLowerBin
    End If
End Sub
Avatar of philipeddies
philipeddies

ASKER

Thanks GrahamSkan but have set the tray in a similar way to this the printer is a brother 6050D and I am printing to the Manual feed tray. Here is the printer code I have so far;

It prints a mail merge to my printer on the manual feed tray, that bit works fine but I need to change the type of paper

'Brother 6050D tray numbers
'---------------------------
'Auto Select -  7
'Tray 1 -       1
'Tray 2 -       2
'MP Tray -      258
'Manual -       4
'---------------------------

'Print the document
currentPrint = Application.ActivePrinter

Application.ActivePrinter = "\\server\prt85"
ActiveDocument.PageSetup.OtherPagesTray = 4
ActiveDocument.PageSetup.FirstPageTray = 4

    With ActiveDocument.MailMerge
        .Destination = wdSendToPrinter
        .SuppressBlankLines = True
        With .DataSource
            .FirstRecord = wdDefaultFirstRecord
            .LastRecord = wdDefaultLastRecord
        End With
        .Execute Pause:=False
    End With
       
    Application.ActivePrinter = currentPrint
    Application.DisplayAlerts = wdAlertsNone
    ThisDocument.Close (False)

For this to be possible:
1. There must be a way of setting the paper thickness on the printer.
2. You must be able to set it electronically.
3. The printer driver must be written to adjust the setting.
4. The adjust method must be available to VBA.

If 1 to 3 are true, then it might worth working on point 4.
The driver dows allow the "media type" to be changed bu I am not sure how to do this with VBA, I would imagine that other people have had the need before but searching on the net has not helpded much.

Thanks
Can you set it for 'Card' in Printer Setup and thus print card manually?

I've looked at the outline specifications for the printer and it Card isn't mentioned.
I don't want to change the printer to card or thick paper as tray 1, 2 and manual feed have different paper types. If I can get a list of the paper types that are available for the printer then I am half way there I used this scrtipt to find out the tray number for the printer I believe it gets the infomation from the driver using an API do you think I could be changed to get a list of the media types?

http://pubs.logicalexpressions.com/Pub0009/LPMArticle.asp?ID=101

Thanks again for the help

Phil
Manually when I go to print I get the options;

Plain Paper    (defualt)
Thin Paper
Thick Paper
Thicker Paper
Bond Paper
Transparencies
Envelopes
Env. thin
Recycled Paper

I am trying to get VBA to use Thicker Paper


If you want a list of the paper types, just record a macro selecting the various options and look at it.
I wish it was that easy but recording a macro does no bring back any changes you make on the driver page (File-Print-Properties)

The recorded macro is as;

    Application.PrintOut FileName:="", Range:=wdPrintAllDocument, Item:= _
        wdPrintDocumentContent, Copies:=1, Pages:="", PageType:=wdPrintAllPages, _
        ManualDuplexPrint:=False, Collate:=True, Background:=True, PrintToFile:= _
        False, PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, _
        PrintZoomPaperHeight:=0
ASKER CERTIFIED SOLUTION
Avatar of Joanne M. Orzech
Joanne M. Orzech
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial