Change printer in vba code

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Nothing

    Change printer in vba code

    I have a form that I send to a printer. The workstation that is using
    the DB has more then one printer defined. The default is NOT the printer
    that I want to use for output from the report/form.

    How do I send the out of a report, using VBA, to a specific printer?

    Michael Charney

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
  • Bas Cost Budde

    #2
    Re: Change printer in vba code

    Nothing wrote:[color=blue]
    > I have a form that I send to a printer. The workstation that is using
    > the DB has more then one printer defined. The default is NOT the printer
    > that I want to use for output from the report/form.
    >
    > How do I send the out of a report, using VBA, to a specific printer?[/color]



    --
    Bas Cost Budde, Holland

    I prefer human mail above automated so in my address
    replace the queue with a tea

    Comment

    • Pieter Linden

      #3
      Re: Change printer in vba code

      Nothing <me@you.com> wrote in message news:<419e232d$ 0$14542$c397aba @news.newsgroup s.ws>...[color=blue]
      > I have a form that I send to a printer. The workstation that is using
      > the DB has more then one printer defined. The default is NOT the printer
      > that I want to use for output from the report/form.
      >
      > How do I send the out of a report, using VBA, to a specific printer?
      >
      > Michael Charney
      >
      > *** Sent via Developersdex http://www.developersdex.com ***
      > Don't just participate in USENET...get rewarded for it![/color]

      Umm... Allen Browne has this somewhere, I think. It's in the Access
      <version#> Handbooks... prolly in this NG... search around.

      Comment

      • Albert D. Kallal

        #4
        Re: Change printer in vba code

        You don't mention what version\ of ms-access.

        In access 2002 and later, there is a built in printer object, and it lets
        you switch the printer with ease.

        You can use:

        Set Application.Pri nter = Application.Pri nters("HP LaserJet Series II")


        The above means you don't need my code.

        So, to save/switch, you can use:

        dim strDefaultPrint er as string

        ' get current default printer.
        strDefaultPrint er = Application.Pri nter.DeviceName

        ' switch to printer of your choice:

        Set Application.Pri nter = Application.Pri nters("HP LaserJet Series II")

        do whatever.

        Swtich back.

        Set Application.Pri nter = Application.Pri nters(strDefaul tPrinter)


        If you are using a earlier versions, then you can use my lightweight
        "simple" printer switch code here:




        --
        Albert D. Kallal (Access MVP)
        Edmonton, Alberta Canada
        pleaseNOOSpamKa llal@msn.com



        Comment

        • Allen Browne

          #5
          Re: Change printer in vba code

          It's at:

          but for Access 2002/2003 only.

          For earlier versions, the article has a link to Albert's code.

          --
          Allen Browne - Microsoft MVP. Perth, Western Australia.
          Tips for Access users - http://allenbrowne.com/tips.html
          Reply to group, rather than allenbrowne at mvps dot org.

          "Pieter Linden" <pietlinden@hot mail.com> replied in message
          news:bf31e41b.0 411191828.5bcde 53a@posting.goo gle.com...[color=blue]
          >
          > Umm... Allen Browne has this somewhere, I think. It's in the Access
          > <version#> Handbooks... prolly in this NG... search around.[/color]


          Comment

          Working...