Article ID: 141621
Article Last Modified on 1/19/2007
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 Public Const HELP_CONTEXTPOPUP = &H8&
Function Help32() As Boolean
On Local Error GoTo Help32_Err
Dim Cid As Long, Result As Long
On Error Resume Next
' Get the HelpContextID of the active control.
' The error is 2474 if no control is active.
Cid = Screen.ActiveControl.HelpContextId
If Cid = 0 Then
' There is no control context ID, so check the form and get
' the HelpContextID of the active form.
' The error is 2475 if no form is active.
Cid = Screen.ActiveForm.HelpContextId
End If
' If there is a context ID, open the Help file with context.
' Specify your custom Help file for the second argument.
If Cid > 0 And Cid < 32767 Then
Result = WinHelp(Application.hWndAccessApp, "C:\Myhelp.Hlp", _
HELP_CONTEXTPOPUP, Cid)
Help32 = True
End If
Help32_End:
Exit Function
Help32_Err:
MsgBox Err.Description
Resume Help32_End
End Function
Macro Name Condition Action
--------------------------------
{F1} RunCode
AutoKeys Action
-------------------------
RunCode
Function Name: Help32()<BR/>
Additional query words: inf
Keywords: kbhowto kbprogramming kbusage KB141621