|
-
October 1st, 2001, 02:50 PM
#1
Issuing a print command to Wordpad
How do you get wordpad to print a .txt file from inside a VB program?
~~~~~~~~~~~~
James Fowler
-
October 1st, 2001, 03:13 PM
#2
Re: Issuing a print command to Wordpad
This code will attempt to open the application associated with the .txt file extension and print the specified file. (The default association is notepad, not wordpad)
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
Const SW_SHOWNORMAL = 1
private Const SW_HIDE = 0
private Sub Command1_Click()
ShellExecute me.hwnd, "print", "C:\Test.txt", vbNullString, vbNullString, SW_SHOWNORMAL
End Sub
-
October 1st, 2001, 03:52 PM
#3
Re: Issuing a print command to Wordpad
Thanks, it worked wonders. =)
and btw I've associated .txt to wordpad so *shrug*
Anyhow, thanks for your help. It is apperciated.
~~~~~~~~~~~~
James Fowler
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|