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

This is probably very easy: how can I call Print Form in a VBA procedure ?
I want the user to select his printer.

Thanks !!
Derek
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 65
Default Calling the Print Form

Derek,

I've used the following code to set printer connectivity. You need to set a
reference to the Windows Script Host Object Model.

'Windows Script Hosting Reference to determine printer connections
Application.StatusBar = "Setting references to Windows Scripting Host"
Dim objScriptControl As iwshnetwork_class
Dim colPrinters As IWshCollection_Class
Set objScriptControl = New iwshnetwork_class
Set colPrinters = objScriptControl.EnumPrinterConnections

Application.StatusBar = "Looking for a Postscript printer"
blnPrinterFound = False
With colPrinters
For intIndex = 0 To .Count
strPrinterName = .Item(intIndex)
If InStr(1, strPrinterName, strPrinterType, vbTextCompare) Or _
InStr(1, strPrinterName, strPrinterType2, vbTextCompare) Then

blnPrinterFound = True

Exit For
End If
strPrinterName = vbNullString
Next intIndex
End With
If blnPrinterFound = False Then
MsgBox "No valid Postscript printer", vbCritical, "Printer"
Exit Sub
End If

The bulk of this code will have to be changed for your purposes, but,
hopefully this is helpful.
--
http://HelpExcel.com
1-888-INGENIO
1-888-464-3646
x0197758


"Derek from Belgium" wrote:

This is probably very easy: how can I call Print Form in a VBA procedure ?
I want the user to select his printer.

Thanks !!
Derek

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Calling the Print Form

Possibly one of these:

Application.Dialogs(xlDialogPrint).show
application.Dialogs(xlDialogPrinterSetup).Show

To demonstrate from the immediate window:

? application.ActivePrinter
\\ardaps01\1D343E on Ne02:
? application.Dialogs(xlDialogPrinterSetup).Show
' selected printer G
? application.ActivePrinter
\\ardaps01\1D343G on Ne04:

--
Regards,
Tom Ogilvy



"Derek from Belgium" <Derek from wrote in
message ...
This is probably very easy: how can I call Print Form in a VBA procedure ?
I want the user to select his printer.

Thanks !!
Derek



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
Print question - Calling Dave Peterson! Ant Excel Discussion (Misc queries) 6 March 28th 06 12:57 PM
Print question - Calling Dave Peterson! Tom Ogilvy Excel Discussion (Misc queries) 1 March 27th 06 06:04 PM
Macro (Print) - Calling Named Ranges KGlennC Excel Discussion (Misc queries) 1 March 19th 05 09:20 PM
Calling Com addin from form button on sheet? Robin Hammond[_2_] Excel Programming 8 January 8th 05 03:03 AM
Calling variable from user form Geraldon Excel Programming 2 February 9th 04 03:18 PM


All times are GMT +1. The time now is 07:31 PM.

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

About Us

"It's about Microsoft Excel"