Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Managing Printing


Hi,

I dont know the question which i am going to ask you all is a possibl
or not. I am actually new to VBA and Macros in excel, so any help woul
be appreciated.
Problem:
I have multiple network printers installed on my computer, one of the
is my default. What I want to do is I want a macro which runs everytim
when I want to print something and asks me which printer you want to us
for these prints, it should ask me from the list of printers installe
on my PC. Please try to simplify things because sorry to say i am ne
to This.

Thanks Very Much

--
darusma
-----------------------------------------------------------------------
darusman's Profile: http://www.excelforum.com/member.php...fo&userid=3691
View this thread: http://www.excelforum.com/showthread.php?threadid=56961

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Managing Printing


This was posted a little while ago by Tom Ogilvy, i suggest you check
out the links first before attempting to use the code for selecting a
printer!

Regards,
Simon

Tom Ogilvy Posts: n/a

Printer Selection

--------------------------------------------------------------------------------

http://support.microsoft.com/?ID=166008
ACC: Enumerating Local and Network Printers

Enumerating Windows' Available Ports
http://www.mvps.org/vbnet/code/enums/enumports.htm
=======================

Posting by KeepItcool

Option Explicit

Private Declare Function GetProfileString Lib "kernel32" _
Alias "GetProfileStringA" _
(ByVal lpAppName As String, ByVal lpKeyName As String, _
ByVal lpDefault As String, ByVal lpReturnedString As String, _
ByVal nSize As Long) As Long

Sub showlist()
MsgBox Join(PrinterList, vbNewLine)
End Sub


Function PrinterList()
Dim lRet As Long
Dim sBuffer As String
Dim lSize As Long
Dim avTmp As Variant
Dim aPrn() As String
Dim n%, sPrn$, sConn$, sPort$

'Get localized Connection string
avTmp = Split(Excel.ActivePrinter)
sConn = " " & avTmp(UBound(avTmp) - 1) & " "
'Get Printers
lSize = 1024
sBuffer = Space(lSize)
lRet = GetProfileString("devices", vbNullString, vbNullString, _
sBuffer, lSize)
sBuffer = Left(sBuffer, lRet)
avTmp = Split(sBuffer, Chr(0))

ReDim Preserve avTmp(UBound(avTmp) - 1)
For n = 0 To UBound(avTmp)
lSize = 128
sBuffer = Space(lSize)
lRet = GetProfileString("devices", avTmp(n), vbNullString, _
sBuffer, lSize)
sPort = Mid(sBuffer, InStr(sBuffer, ",") + 1, _
lRet - InStr(sBuffer, ","))
avTmp(n) = avTmp(n) & sConn & sPort
Next
PrinterList = avTmp
End Function


--
Regards,
Tom Ogilvy


--
Simon Lloyd
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.excelforum.com/member.php...fo&userid=6708
View this thread: http://www.excelforum.com/showthread...hreadid=569612

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Managing Printing darusman Excel Programming 0 August 8th 06 09:27 PM
Managing Add-Ins [email protected] Excel Programming 1 June 8th 05 09:47 PM
Managing menus via VBA mddawson - ExcelForums.com Excel Programming 3 June 6th 05 04:08 PM
Managing a big report nbeaird Excel Discussion (Misc queries) 0 March 16th 05 03:25 PM
MANAGING MACROS angie Excel Programming 1 February 11th 04 09:36 AM


All times are GMT +1. The time now is 08:16 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"