use macro to select printer profile...

B

BJ

we have a profile set up in a network printer. are there anyway to select
this profile using VBA macro?

thank you for any help.
 
D

Dave Peterson

I'm not sure what a printer profile is, but maybe you can just show the user the
screen to select the printer???

Application.Dialogs(xlDialogPrinterSetup).Show
or
Application.Dialogs(xlDialogPrint).Show
 
B

BJ

There is a profile has been assigned to this network printer. this profile
has setup sepcificly for an Excel report. by choosing this profile, user
doesn't need to set up the property each time, for example, print on both
side, legel paper...etc. we have finished the code that select this network
printer as a default printer. the problem is how to select this profile from
the printer through macro. user just wants to click on the 'Print' button
from the macro then get the print out from the printer. no more click.
 
D

Dave Peterson

I think you'd have to know the name of the profile--and can't it change for each
user?

This may help if that last portion NE01, NE02, ... may change:

Option Explicit
Sub testme()
Dim iCtr As Long
Dim FoundIt As Boolean
Dim CurPrinter As String

CurPrinter = Application.ActivePrinter

FoundIt = False
For iCtr = 0 To 99
On Error Resume Next
Application.ActivePrinter = "\\EMAILPC\HP LaserJet 2100 Series PS on Ne" _
& Format(iCtr, "00") & ":"
If Err.Number = 0 Then
FoundIt = True
Exit For
Else
'keep looking
Err.Clear
End If
Next iCtr
On Error GoTo 0

If FoundIt = False Then
MsgBox "No printer close to that name"
Else
'do the real work
'and change it back
Application.ActivePrinter = CurPrinter
End If
End Sub

You'll have to provide the portion of the string that doesn't change.

Ps. I'm still not sure what a printer profile is. So feel free to ignore this
if it's not close to what you need.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top