I have a Help and Instuctions file created in Notepad for my app. How do I make it accessible from my mnuHelp_Click() event? When I distribute my app how do I make the notepad file go with it?
Thanks for any help with this!
JO
Printable View
I have a Help and Instuctions file created in Notepad for my app. How do I make it accessible from my mnuHelp_Click() event? When I distribute my app how do I make the notepad file go with it?
Thanks for any help with this!
JO
You can have the helpfile ShellExecuted.
And to distribute it you can simply package it with P&DW that is shipped with VB. Simply look through the start menu for it. When packaging it will ask if you would like to add any files...you can select the help file then.Code: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
Private Sub mnuHelp_Click()
ShellExecute(app.path "\help.txt")
End Sub
Gl,
D!m
You could set the Shortcut in the Menu Editor for F1 and put this code in it:
You can also set your Form's KeyPreview property to True and add this:Code:Private Sub mnuHelp_Click()
Shell "Notepad.exe " & App.Path & "\myhelpfile.txt", vbNormalFocus
End Sub
Both will work.Code:Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case vbKeyF1 'F1 pressed
Shell "Notepad.exe " & App.Path & "\myhelpfile.txt", vbNormalFocus
'Loads your txt file with notepad
'txt file is located in your exe's directory
End Select
End Sub
They all work, Thanks to both of you.
But what if I don't know the directory the user will choose?
Assuming your help file will be in the exe's directory, you can use App.Path to determine the exe's directory.
Put this in a form and see for yourself:
You should know where the help file will be placed.Code:Private Sub Form_Load()
Msgbox App.Path
End Sub
Forgot to say thanks!!!!
I got it going!
JO