How do I open a help file at a certain topic or content section of it with a command button? Here's my code thus far. It opens the help file, but I want to jump to a certain spot. I'm doing this in Access too, if that makes a difference. (Likely not)
Code:Private Declare Function WinHelp _ Lib "user32" Alias "WinHelpA" ( _ ByVal hwnd As Long, _ ByVal lpHelpFile As String, _ ByVal wCommand As Long, _ ByVal dwData As Long) As Long Private Const HELP_CONTENTS = &H3& Private Const HELP_QUIT = &H2 Option Compare Database Option Explicit Private Function DBPath() As String Dim strDBPath As String Dim strDBFile As String strDBPath = CurrentDb.Name strDBFile = Dir(strDBPath) DBPath = Left(strDBPath, Len(strDBPath) - Len(strDBFile)) End Function Private Function FileExists(ByVal FileName As String) As Boolean If Dir(FileName) = "" Then FileExists = False Else FileExists = True End If End Function Private Sub Command0_Click() Dim strHelpFile As String strHelpFile = DBPath & "LegalTracking.hlp" If FileExists(strHelpFile) Then WinHelp Me.hwnd, strHelpFile, HELP_CONTENTS, 0 Else MsgBox "Could not locate help file. Try contacting your database administrator.", vbOKOnly, "Unable to locate help file." End If End Sub




Reply With Quote