473,395 Members | 1,442 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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

Apr 13 '06 #1
2 2774
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


Apr 13 '06 #2

Yoman wrote:
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


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

Apr 17 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Mark | last post by:
I am looking for a switchboard creator alternative for my MDB. Can anyone help me? Thanks for your help, Mark
2
by: Terry | last post by:
I have created a switchboard, created using Access 2000. If I put the mouse anywhere on the form, outside of the checkboxes and scroll the wheel backwards, I get the following error. Run-Time...
4
by: Rampar | last post by:
I did some customizing on my switchboard (changing colors and adding graphics) to make it more appealing. I tried to add another item, and it told me that 8 was the limit. Fine. I deleted one...
5
by: Michael Keene | last post by:
I have a query that I'd like to add to my switchboard, but when I use the switchboard manager I only get the option to run a report, a macro or open a form. Is there a way to add a query without...
1
by: jimwlee | last post by:
Hi all, I mistakenly deleted my switchboard on the Object Forms view. I recreated it again with the database utility, but the switchboard isn't showing up in the forms view. Any ideas? Thanks in...
0
by: Ace Calhoon | last post by:
Has anyone encountered this before? When a report is opened by my switchboard (i.e. either directly, or through code run by the switchboard), a crash occurs when changing print settings. So...
1
by: mplus_2000 | last post by:
I have recently inherited a database. The switchboard (and other forms) displays the name of the database on it (top, center). Currently the name that appears is Reviews. There are plans to roll...
2
by: Earl Anderson | last post by:
In Acc2003, I have a situation in which I have a main switchboard and upon pressing one of its buttons , takes the user to another sub hierarchical switchboard. Pressing one of these buttons could...
4
by: pacarv | last post by:
I've created a database in Access 2003 with multiple reports that are accessable from the switchboard. The switchboard also has a print button. The user selects the report from the menu which then...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.