J Fowler
October 1st, 2001, 02:50 PM
How do you get wordpad to print a .txt file from inside a VB program?
~~~~~~~~~~~~
James Fowler
~~~~~~~~~~~~
James Fowler
|
Click to See Complete Forum and Search --> : Issuing a print command to Wordpad J Fowler October 1st, 2001, 02:50 PM How do you get wordpad to print a .txt file from inside a VB program? ~~~~~~~~~~~~ James Fowler DSJ October 1st, 2001, 03:13 PM 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 J Fowler October 1st, 2001, 03:52 PM Thanks, it worked wonders. =) and btw I've associated .txt to wordpad so *shrug* Anyhow, thanks for your help. It is apperciated. ~~~~~~~~~~~~ James Fowler codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |