By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,663 Members | 1,194 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,663 IT Pros & Developers. It's quick & easy.

restoring default printer

P: n/a
I have vb code that gives a user the option to select the printer for
printing a report. At the end I change the default printer back to what
it was. Unfortunately the code I found is for win9x so it is not
working when restoring the default, and I cannot find anything on what
the XP code is.

Win9x code is: Call SendMessage(HWND_BROADCAST, WM_WININICHANGE, 0,
ByVal "windows")

Does anyone know what it is for XP?

Nov 13 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
On 6 Sep 2005 15:07:54 -0700, "sakuragirl1" <sa*********@yahoo.com>
wrote:

This is NOT the code that changes the printer. Rather, this broadcasts
to all applications that some system setting change has been made.
Apps can listen for such messages, and configure themselves
accordingly.

In Access2002 and up, you may want to look at the new Printer object.

-Tom.

I have vb code that gives a user the option to select the printer for
printing a report. At the end I change the default printer back to what
it was. Unfortunately the code I found is for win9x so it is not
working when restoring the default, and I cannot find anything on what
the XP code is.

Win9x code is: Call SendMessage(HWND_BROADCAST, WM_WININICHANGE, 0,
ByVal "windows")

Does anyone know what it is for XP?


Nov 13 '05 #2

P: n/a
yes, my lightweight printer switch code often has this probelm.

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.Printer = Application.Printers("HP LaserJet Series II")

The above means you don't need my code.

So, to save/switch, you can use:

dim strDefaultPrinter as string

' get current default printer.
strDefaultPrinter = Application.Printer.DeviceName

' switch to printer of your choice:

Set Application.Printer = Application.Printers("HP LaserJet Series II")

do whatever.

Swtich back.

Set Application.Printer = Application.Printers(strDefaultPrinter)
If you are using a earlier versions, then you can use my lightweight printer
switch code here:

http://www.members.shaw.ca/AlbertKal.../msaccess.html

And, I don't have a good solution to your problem, but if you use acces 2002
or later...it don't matter
--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pl*****************@msn.com
http://www.members.shaw.ca/AlbertKallal
Nov 13 '05 #3

P: n/a
Thank you so much for your help. I am using Access 2003, and the
information you provided fixed the issue i was having. If you can't
tell this is one of my first Access projects, and I really appreciate
having a place where I can ask questions, and have them answered! ^_^

Nov 13 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.