Solved

Default Printer

Posted on 2004-04-23
4
268 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 14

Accepted Solution

by:
aelatik earned 125 total points
ID: 10899747
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
ID: 10899852
in VBA this also result the default printer...

MsgBox Application.ActivePrinter
0
 
LVL 48

Expert Comment

by:Mikal613
ID: 10900497
msgbox printer.DeviceName
0

Featured Post

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…
Suggested Courses
Course of the Month5 days, 19 hours left to enroll

627 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