Connecting Tech Pros Worldwide Help | Site Map

How do you print word doc from switchboard

 
LinkBack Thread Tools Search this Thread
  #1  
Old April 13th, 2006, 08:15 PM
Intalexual
Guest
 
Posts: n/a
Default How do you print word doc from switchboard

Ok, I'm having a little trouble finding the correct way to have a word
document print out in the background when selecting it on the
switchboard. Is there any way this can be done? I already found a way
to open up the document using a macro with the RunApp action. Any help
would be greatly appreciated, Thank you


  #2  
Old April 13th, 2006, 09:25 PM
Yoman
Guest
 
Posts: n/a
Default Re: How do you print word doc from switchboard

Hi,

This code is the best way to open and print any documents type

Regards

Robert Simard
Logipro
http://www.logicielappui.com/tips


'// Code Start
Option Compare Database
Option Explicit

Public Const SW_HIDE = 0
Public Const SW_SHOWNORMAL = 1
Public Const SW_SHOWMINIMIZED = 2
Public Const SW_SHOWMAXIMIZED = 3
Public Const SW_SHOWNOACTIVATE = 4
Public Const SW_SHOW = 5
Public Const SW_MINIMIZE = 6
Public Const SW_SHOWMINNOACTIVE = 7
Public Const SW_SHOWNA = 8
Public Const SW_RESTORE = 9

Private Declare Function GetDesktopWindow Lib "user32" () As Long
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


'Usage : Call RunShellExecute("Open","c:\test.doc", 0&, 0&, SW_SHOWNORMAL)
' Call RunShellExecute("Print","c:\test.doc", 0&, 0&, SW_SHOWNORMAL)
Public Sub RunShellExecute(sTopic As String, sFile As Variant, sParams As
Variant, sDirectory As Variant, nShowCmd As Long)

Dim hWndDesk As Long
Dim success As Long

hWndDesk = GetDesktopWindow()

success = ShellExecute(hWndDesk, sTopic, sFile, sParams, sDirectory,
nShowCmd)

'on error "Open with"
If success = 31 Then
Call Shell("rundll32.exe shell32.dll,OpenAs_RunDLL " & sFile,
vbNormalFocus)
End If

End Sub




  #3  
Old April 17th, 2006, 01:18 PM
Intalexual
Guest
 
Posts: n/a
Default Re: How do you print word doc from switchboard


Yoman wrote:[color=blue]
> Hi,
>
> This code is the best way to open and print any documents type
>
> Regards
>
> Robert Simard
> Logipro
> http://www.logicielappui.com/tips
>
>
> '// Code Start
> Option Compare Database
> Option Explicit
>
> Public Const SW_HIDE = 0
> Public Const SW_SHOWNORMAL = 1
> Public Const SW_SHOWMINIMIZED = 2
> Public Const SW_SHOWMAXIMIZED = 3
> Public Const SW_SHOWNOACTIVATE = 4
> Public Const SW_SHOW = 5
> Public Const SW_MINIMIZE = 6
> Public Const SW_SHOWMINNOACTIVE = 7
> Public Const SW_SHOWNA = 8
> Public Const SW_RESTORE = 9
>
> Private Declare Function GetDesktopWindow Lib "user32" () As Long
> 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
>
>
> 'Usage : Call RunShellExecute("Open","c:\test.doc", 0&, 0&, SW_SHOWNORMAL)
> ' Call RunShellExecute("Print","c:\test.doc", 0&, 0&, SW_SHOWNORMAL)
> Public Sub RunShellExecute(sTopic As String, sFile As Variant, sParams As
> Variant, sDirectory As Variant, nShowCmd As Long)
>
> Dim hWndDesk As Long
> Dim success As Long
>
> hWndDesk = GetDesktopWindow()
>
> success = ShellExecute(hWndDesk, sTopic, sFile, sParams, sDirectory,
> nShowCmd)
>
> 'on error "Open with"
> If success = 31 Then
> Call Shell("rundll32.exe shell32.dll,OpenAs_RunDLL " & sFile,
> vbNormalFocus)
> End If
>
> End Sub[/color]

I'm kinda new at this, Can you help me step by step? I want to print
it off a switchboard item.

 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.