+ Reply to Thread
Results 1 to 4 of 4

Inputbox - HELP button not displayed

Hybrid View

  1. #1
    Registered User
    Join Date
    06-05-2008
    Posts
    4

    Inputbox - HELP button not displayed

    I'm using the InputBox Method to get a text value from the user. This works fine, but I want to add a help button to the Inputbox.

    According to Excel VBA help, the following should display a help button, but it doesn't.

    Private Sub CCNProject()
        Dim strProjectNum As String
        Dim strHelpFileName As String
        Dim intHelpTopic As Integer
        
        intHelpTopic = 160
        strHelpFileName = ThisWorkbook.Path & "\SRU.hlp"
       
        strProjectNum = Application.InputBox( _
                prompt:="Enter a two digit project number (01 to 99)", _
                Title:="SRU Create New Project", _
                HelpFile:=strHelpFileName, _
                HelpContextID:=intHelpTopic, _
                Type:=2)
                
    End Sub
    Anyone have any idea why this isn't displaying the help button?

  2. #2
    Forum Expert Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,161
    I'm not entirely sure you can display a help button but your syntax was wrong try this version:
    strProjectNum = Application.InputBox("Enter a two digit project number (01 to 99)", _
    "SRU Create New Project", , , , strhelpfilename, inthelptopic, 2)
    Not all forums are the same - seek and you shall find

  3. #3
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Simon

    The OP's syntax is fine - you can state the property names as an alternative to just leaving the field blank, as in your comma example. The Excel help files also state explicitly that using Application.InputBox you can have a Help button displayed if you state the properties. The only thing the OP appeared to be doing incorrectly was setting the type name of the variable as string and integer - the type name for both variable should have been variants, but using that I still can't get it to work.

    This link actually refers to XL2007, but the text is the same as that included in XL2003's help file, and as VBA is no longer supported, I can't imagine this working in Office 12, and not Office 11. I also can't recall ever seeing or using a help button in an Application.Inputbox and can't find a working example on the internet - or any bug reports saying it doesn't work.

    Can anyone else shed any light ...

    DominicB
    Please familiarise yourself with the rules before posting. You can find them here.

  4. #4
    Registered User
    Join Date
    06-05-2008
    Posts
    4

    Solution

    Found a solution myself: using the InputBox function instead of method:

            strProjectNum = InputBox(prompt:="Enter a two digit project number (01 to 99)", _
                Title:="SRU Create New Project", _
                HelpFile:=strHelpFileName, _
                Context:=intHelpTopic)
    This works fine, and although it has the limitations of accepting text only, this is what I want in my case.
    Still can't see why the original code doesn't work, though

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1