Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Launching and viewing Notepad Docs from Application

Status
Not open for further replies.

Eduofon

Programmer
Oct 17, 2001
7
NG
Need help urgently. Please how can I launch and view a Text document in Notepad on the click of a button. Thanks don't want to have to use any forms or controls to read out the file and display it first.

Thanks
 
You can use the Shell command. If you do a search in the forum for Shell I'm sure you'll find loads of examples.

Hope it helps,
Tom
 
The shell command only works for exe's. My project doesn't recognize The ShellExecute command, so what do I do?
 
Couple of things - Notepad is an exe so you can use the Shell command to execute notepad.

Second, ShellExecute is not a VB command, but rather is an API call, therefore, the function must be declared, usually in a module.
Code:
Public 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
Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Thanks one more thing, please what's the long variable for the constant SW_SHOWNORM. Thanks
 
Alright, thanks for everything. sorted it out.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top