Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Print Command on a file

is there a way to execute the print command on a file from excel. liek if
you were to right click on a file and choose print from the shortcut menu.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Print Command on a file

If the file is open you can use
http://www.rondebruin.nl/print.htm#Print


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Spencer Hutton" wrote in message ...
is there a way to execute the print command on a file from excel. liek if
you were to right click on a file and choose print from the shortcut menu.




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Print Command on a file

is there a way to execute the print command on a file from excel. liek if
you were to right click on a file and choose print from the shortcut menu.


This one works for me:

ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True

-- John
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default Print Command on a file

"Spencer Hutton" wrote in message ...
is there a way to execute the print command on a file from excel. liek if
you were to right click on a file and choose print from the shortcut menu.


To simulate this then amend this to your needs
This prints a word Doc....

Option Explicit

Private Declare Function ShellExecute _
Lib "shell32.dll" _
Alias "ShellExecuteA" ( _
ByVal hwnd As Long, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) _
As Long

Private Const SW_HIDE = 0
Private Const strFilePath As String = "C:\White Rose\Templates\WRS
Compliments Slips.doc"

Sub WordPrint()
Dim retVal As Long

retVal = ShellExecute(0, "Print", strFilePath, 0, 0, SW_HIDE)

If retVal < 32 Then
'// there are Error codes for this..left out
MsgBox "An Error occured...could not print"
End If

End Sub
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
command line options/switches to print excel file Stranger[_2_] Excel Worksheet Functions 2 March 18th 09 06:36 AM
command line options/switches to print excel file Stranger[_2_] Excel Discussion (Misc queries) 1 March 17th 09 01:04 PM
How to format the extension less file to print with Dos's Print Command Badshah Excel Discussion (Misc queries) 0 November 28th 06 12:44 PM
Create command button to print multiple worksheets in a excel file MarcoR Excel Discussion (Misc queries) 3 June 26th 06 07:07 PM
Office2000: Missing Print command in File menu Arvi Laanemets Excel Discussion (Misc queries) 4 March 28th 06 01:20 PM


All times are GMT +1. The time now is 06:40 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"