Solved

Default Printer

Posted on 2004-04-23
4
258 Views
Last Modified: 2010-05-02
Hello,
  Can someone help me, I am trying to get the name of the current default printer, I am using VBA (Microsoft Access 2000).

I want to be able to display the current name of the default printer.  

Cheers everyone.

0
Comment
Question by:PhillipBarber
  • 2
4 Comments
 
LVL 14

Accepted Solution

by:
aelatik earned 125 total points
Comment Utility
Wmi call would do it...

On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_Printer", , 48)
For Each objItem In colItems
    If objItem.Attributes And 4 Then ' attr nr. 4 represents default printer
       MsgBox objItem.Name
    End If
Next
0
 
LVL 14

Expert Comment

by:aelatik
Comment Utility
in VBA this also result the default printer...

MsgBox Application.ActivePrinter
0
 
LVL 48

Expert Comment

by:Mikal613
Comment Utility
msgbox printer.DeviceName
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now