Solved

Default Printer

Posted on 2004-04-23
4
267 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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
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…

734 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