+ Reply to Thread
Results 1 to 14 of 14

Maximum length Prompt in Application.InputBox

  1. #1
    RB Smissaert
    Guest

    Maximum length Prompt in Application.InputBox

    Was caught out by the fact that the maximum length of the Prompt in
    Application.InputBox is much less than in the
    regular InputBox. The trouble was that the error you get is Runtime error
    13: Type mismatch, so I was looking at the
    datatypes of the different arguments, but the trouble is not with those.
    The other trouble was that this seems to be mentioned nowhere.

    It looks the maximum lenght of the Prompt with Application.InputBox is 256:

    Sub test()

    Dim i As Long
    Dim lResult As Long
    Dim strResult As String

    On Error GoTo PAST1
    For i = 245 To 400
    SendKeys "{ENTER}", False
    lResult = Application.InputBox(String(i, "x"), "title", 10, Type:=1)
    Next

    PAST1:
    MsgBox i, , "maximum prompt length with Application.InputBox"
    MsgBox i, , "maximum prompt length with Application.InputBox"

    On Error GoTo PAST2
    For i = 200 To 10000
    SendKeys "{ENTER}", False
    strResult = InputBox(String(i, "x"), "title", "a")
    Next

    PAST2:
    MsgBox i, , "maximum prompt length with InputBox"
    MsgBox i, , "maximum prompt length with InputBox"

    End Sub


    Haven't found the maximum yet with the regular InputBox, but it is much
    more.

    Is this is a known problem? I suppose it is.
    Is there a workaround? I suppose not.


    RBS


  2. #2
    Dave Peterson
    Guest

    Re: Maximum length Prompt in Application.InputBox

    I don't ever recall using an inputbox to get a long string like that (even 255
    characters).

    Maybe designing a form and using a textbox would be a way around it.

    RB Smissaert wrote:
    >
    > Was caught out by the fact that the maximum length of the Prompt in
    > Application.InputBox is much less than in the
    > regular InputBox. The trouble was that the error you get is Runtime error
    > 13: Type mismatch, so I was looking at the
    > datatypes of the different arguments, but the trouble is not with those.
    > The other trouble was that this seems to be mentioned nowhere.
    >
    > It looks the maximum lenght of the Prompt with Application.InputBox is 256:
    >
    > Sub test()
    >
    > Dim i As Long
    > Dim lResult As Long
    > Dim strResult As String
    >
    > On Error GoTo PAST1
    > For i = 245 To 400
    > SendKeys "{ENTER}", False
    > lResult = Application.InputBox(String(i, "x"), "title", 10, Type:=1)
    > Next
    >
    > PAST1:
    > MsgBox i, , "maximum prompt length with Application.InputBox"
    > MsgBox i, , "maximum prompt length with Application.InputBox"
    >
    > On Error GoTo PAST2
    > For i = 200 To 10000
    > SendKeys "{ENTER}", False
    > strResult = InputBox(String(i, "x"), "title", "a")
    > Next
    >
    > PAST2:
    > MsgBox i, , "maximum prompt length with InputBox"
    > MsgBox i, , "maximum prompt length with InputBox"
    >
    > End Sub
    >
    > Haven't found the maximum yet with the regular InputBox, but it is much
    > more.
    >
    > Is this is a known problem? I suppose it is.
    > Is there a workaround? I suppose not.
    >
    > RBS


    --

    Dave Peterson

  3. #3
    Dave Peterson
    Guest

    Re: Maximum length Prompt in Application.InputBox

    And if you're really concerned about the length of the string returned, why use
    application.inputbox at all.

    You're probably not getting a number, formula, range, ....

    RB Smissaert wrote:
    >
    > Was caught out by the fact that the maximum length of the Prompt in
    > Application.InputBox is much less than in the
    > regular InputBox. The trouble was that the error you get is Runtime error
    > 13: Type mismatch, so I was looking at the
    > datatypes of the different arguments, but the trouble is not with those.
    > The other trouble was that this seems to be mentioned nowhere.
    >
    > It looks the maximum lenght of the Prompt with Application.InputBox is 256:
    >
    > Sub test()
    >
    > Dim i As Long
    > Dim lResult As Long
    > Dim strResult As String
    >
    > On Error GoTo PAST1
    > For i = 245 To 400
    > SendKeys "{ENTER}", False
    > lResult = Application.InputBox(String(i, "x"), "title", 10, Type:=1)
    > Next
    >
    > PAST1:
    > MsgBox i, , "maximum prompt length with Application.InputBox"
    > MsgBox i, , "maximum prompt length with Application.InputBox"
    >
    > On Error GoTo PAST2
    > For i = 200 To 10000
    > SendKeys "{ENTER}", False
    > strResult = InputBox(String(i, "x"), "title", "a")
    > Next
    >
    > PAST2:
    > MsgBox i, , "maximum prompt length with InputBox"
    > MsgBox i, , "maximum prompt length with InputBox"
    >
    > End Sub
    >
    > Haven't found the maximum yet with the regular InputBox, but it is much
    > more.
    >
    > Is this is a known problem? I suppose it is.
    > Is there a workaround? I suppose not.
    >
    > RBS


    --

    Dave Peterson

  4. #4
    Dave Peterson
    Guest

    Re: Maximum length Prompt in Application.InputBox

    It looks like the VBA inputbox is 254 characters.

    Please ignore the previous message.



    Dave Peterson wrote:
    >
    > And if you're really concerned about the length of the string returned, why use
    > application.inputbox at all.
    >
    > You're probably not getting a number, formula, range, ....
    >
    > RB Smissaert wrote:
    > >
    > > Was caught out by the fact that the maximum length of the Prompt in
    > > Application.InputBox is much less than in the
    > > regular InputBox. The trouble was that the error you get is Runtime error
    > > 13: Type mismatch, so I was looking at the
    > > datatypes of the different arguments, but the trouble is not with those.
    > > The other trouble was that this seems to be mentioned nowhere.
    > >
    > > It looks the maximum lenght of the Prompt with Application.InputBox is 256:
    > >
    > > Sub test()
    > >
    > > Dim i As Long
    > > Dim lResult As Long
    > > Dim strResult As String
    > >
    > > On Error GoTo PAST1
    > > For i = 245 To 400
    > > SendKeys "{ENTER}", False
    > > lResult = Application.InputBox(String(i, "x"), "title", 10, Type:=1)
    > > Next
    > >
    > > PAST1:
    > > MsgBox i, , "maximum prompt length with Application.InputBox"
    > > MsgBox i, , "maximum prompt length with Application.InputBox"
    > >
    > > On Error GoTo PAST2
    > > For i = 200 To 10000
    > > SendKeys "{ENTER}", False
    > > strResult = InputBox(String(i, "x"), "title", "a")
    > > Next
    > >
    > > PAST2:
    > > MsgBox i, , "maximum prompt length with InputBox"
    > > MsgBox i, , "maximum prompt length with InputBox"
    > >
    > > End Sub
    > >
    > > Haven't found the maximum yet with the regular InputBox, but it is much
    > > more.
    > >
    > > Is this is a known problem? I suppose it is.
    > > Is there a workaround? I suppose not.
    > >
    > > RBS

    >
    > --
    >
    > Dave Peterson


    --

    Dave Peterson

  5. #5
    RB Smissaert
    Guest

    Re: Maximum length Prompt in Application.InputBox

    I am not talking about the return from the function, but the Prompt
    argument.

    RBS


    "Dave Peterson" <petersod@verizonXSPAM.net> wrote in message
    news:43EBA03E.DBC2B77A@verizonXSPAM.net...
    > And if you're really concerned about the length of the string returned,
    > why use
    > application.inputbox at all.
    >
    > You're probably not getting a number, formula, range, ....
    >
    > RB Smissaert wrote:
    >>
    >> Was caught out by the fact that the maximum length of the Prompt in
    >> Application.InputBox is much less than in the
    >> regular InputBox. The trouble was that the error you get is Runtime error
    >> 13: Type mismatch, so I was looking at the
    >> datatypes of the different arguments, but the trouble is not with those.
    >> The other trouble was that this seems to be mentioned nowhere.
    >>
    >> It looks the maximum lenght of the Prompt with Application.InputBox is
    >> 256:
    >>
    >> Sub test()
    >>
    >> Dim i As Long
    >> Dim lResult As Long
    >> Dim strResult As String
    >>
    >> On Error GoTo PAST1
    >> For i = 245 To 400
    >> SendKeys "{ENTER}", False
    >> lResult = Application.InputBox(String(i, "x"), "title", 10, Type:=1)
    >> Next
    >>
    >> PAST1:
    >> MsgBox i, , "maximum prompt length with Application.InputBox"
    >> MsgBox i, , "maximum prompt length with Application.InputBox"
    >>
    >> On Error GoTo PAST2
    >> For i = 200 To 10000
    >> SendKeys "{ENTER}", False
    >> strResult = InputBox(String(i, "x"), "title", "a")
    >> Next
    >>
    >> PAST2:
    >> MsgBox i, , "maximum prompt length with InputBox"
    >> MsgBox i, , "maximum prompt length with InputBox"
    >>
    >> End Sub
    >>
    >> Haven't found the maximum yet with the regular InputBox, but it is much
    >> more.
    >>
    >> Is this is a known problem? I suppose it is.
    >> Is there a workaround? I suppose not.
    >>
    >> RBS

    >
    > --
    >
    > Dave Peterson



  6. #6
    Dave Peterson
    Guest

    Re: Maximum length Prompt in Application.InputBox

    Oh. Nevermind.

    But there are limits to everything (well, almost).

    If you do need a longer prompt, maybe a userform would be better.

    RB Smissaert wrote:
    >
    > I am not talking about the return from the function, but the Prompt
    > argument.
    >
    > RBS
    >
    > "Dave Peterson" <petersod@verizonXSPAM.net> wrote in message
    > news:43EBA03E.DBC2B77A@verizonXSPAM.net...
    > > And if you're really concerned about the length of the string returned,
    > > why use
    > > application.inputbox at all.
    > >
    > > You're probably not getting a number, formula, range, ....
    > >
    > > RB Smissaert wrote:
    > >>
    > >> Was caught out by the fact that the maximum length of the Prompt in
    > >> Application.InputBox is much less than in the
    > >> regular InputBox. The trouble was that the error you get is Runtime error
    > >> 13: Type mismatch, so I was looking at the
    > >> datatypes of the different arguments, but the trouble is not with those.
    > >> The other trouble was that this seems to be mentioned nowhere.
    > >>
    > >> It looks the maximum lenght of the Prompt with Application.InputBox is
    > >> 256:
    > >>
    > >> Sub test()
    > >>
    > >> Dim i As Long
    > >> Dim lResult As Long
    > >> Dim strResult As String
    > >>
    > >> On Error GoTo PAST1
    > >> For i = 245 To 400
    > >> SendKeys "{ENTER}", False
    > >> lResult = Application.InputBox(String(i, "x"), "title", 10, Type:=1)
    > >> Next
    > >>
    > >> PAST1:
    > >> MsgBox i, , "maximum prompt length with Application.InputBox"
    > >> MsgBox i, , "maximum prompt length with Application.InputBox"
    > >>
    > >> On Error GoTo PAST2
    > >> For i = 200 To 10000
    > >> SendKeys "{ENTER}", False
    > >> strResult = InputBox(String(i, "x"), "title", "a")
    > >> Next
    > >>
    > >> PAST2:
    > >> MsgBox i, , "maximum prompt length with InputBox"
    > >> MsgBox i, , "maximum prompt length with InputBox"
    > >>
    > >> End Sub
    > >>
    > >> Haven't found the maximum yet with the regular InputBox, but it is much
    > >> more.
    > >>
    > >> Is this is a known problem? I suppose it is.
    > >> Is there a workaround? I suppose not.
    > >>
    > >> RBS

    > >
    > > --
    > >
    > > Dave Peterson


    --

    Dave Peterson

  7. #7
    RB Smissaert
    Guest

    Re: Maximum length Prompt in Application.InputBox

    I will just shorten the prompts.
    I don't want to add more userforms as this add-in is big
    enough already.
    Maybe an option might be to put it in an VB6 ActiveX dll
    or make a form on the fly.

    RBS

    "Dave Peterson" <petersod@verizonXSPAM.net> wrote in message
    news:43EBA388.78CDC722@verizonXSPAM.net...
    > Oh. Nevermind.
    >
    > But there are limits to everything (well, almost).
    >
    > If you do need a longer prompt, maybe a userform would be better.
    >
    > RB Smissaert wrote:
    >>
    >> I am not talking about the return from the function, but the Prompt
    >> argument.
    >>
    >> RBS
    >>
    >> "Dave Peterson" <petersod@verizonXSPAM.net> wrote in message
    >> news:43EBA03E.DBC2B77A@verizonXSPAM.net...
    >> > And if you're really concerned about the length of the string returned,
    >> > why use
    >> > application.inputbox at all.
    >> >
    >> > You're probably not getting a number, formula, range, ....
    >> >
    >> > RB Smissaert wrote:
    >> >>
    >> >> Was caught out by the fact that the maximum length of the Prompt in
    >> >> Application.InputBox is much less than in the
    >> >> regular InputBox. The trouble was that the error you get is Runtime
    >> >> error
    >> >> 13: Type mismatch, so I was looking at the
    >> >> datatypes of the different arguments, but the trouble is not with
    >> >> those.
    >> >> The other trouble was that this seems to be mentioned nowhere.
    >> >>
    >> >> It looks the maximum lenght of the Prompt with Application.InputBox is
    >> >> 256:
    >> >>
    >> >> Sub test()
    >> >>
    >> >> Dim i As Long
    >> >> Dim lResult As Long
    >> >> Dim strResult As String
    >> >>
    >> >> On Error GoTo PAST1
    >> >> For i = 245 To 400
    >> >> SendKeys "{ENTER}", False
    >> >> lResult = Application.InputBox(String(i, "x"), "title", 10,
    >> >> Type:=1)
    >> >> Next
    >> >>
    >> >> PAST1:
    >> >> MsgBox i, , "maximum prompt length with Application.InputBox"
    >> >> MsgBox i, , "maximum prompt length with Application.InputBox"
    >> >>
    >> >> On Error GoTo PAST2
    >> >> For i = 200 To 10000
    >> >> SendKeys "{ENTER}", False
    >> >> strResult = InputBox(String(i, "x"), "title", "a")
    >> >> Next
    >> >>
    >> >> PAST2:
    >> >> MsgBox i, , "maximum prompt length with InputBox"
    >> >> MsgBox i, , "maximum prompt length with InputBox"
    >> >>
    >> >> End Sub
    >> >>
    >> >> Haven't found the maximum yet with the regular InputBox, but it is
    >> >> much
    >> >> more.
    >> >>
    >> >> Is this is a known problem? I suppose it is.
    >> >> Is there a workaround? I suppose not.
    >> >>
    >> >> RBS
    >> >
    >> > --
    >> >
    >> > Dave Peterson

    >
    > --
    >
    > Dave Peterson



  8. #8
    Tom Ogilvy
    Guest

    Re: Maximum length Prompt in Application.InputBox

    RTP <g>

    --
    Regards,
    Tom Ogilvy

    "Dave Peterson" <petersod@verizonXSPAM.net> wrote in message
    news:43EBA121.CBA5F0E3@verizonXSPAM.net...
    > It looks like the VBA inputbox is 254 characters.
    >
    > Please ignore the previous message.
    >
    >
    >
    > Dave Peterson wrote:
    > >
    > > And if you're really concerned about the length of the string returned,

    why use
    > > application.inputbox at all.
    > >
    > > You're probably not getting a number, formula, range, ....
    > >
    > > RB Smissaert wrote:
    > > >
    > > > Was caught out by the fact that the maximum length of the Prompt in
    > > > Application.InputBox is much less than in the
    > > > regular InputBox. The trouble was that the error you get is Runtime

    error
    > > > 13: Type mismatch, so I was looking at the
    > > > datatypes of the different arguments, but the trouble is not with

    those.
    > > > The other trouble was that this seems to be mentioned nowhere.
    > > >
    > > > It looks the maximum lenght of the Prompt with Application.InputBox is

    256:
    > > >
    > > > Sub test()
    > > >
    > > > Dim i As Long
    > > > Dim lResult As Long
    > > > Dim strResult As String
    > > >
    > > > On Error GoTo PAST1
    > > > For i = 245 To 400
    > > > SendKeys "{ENTER}", False
    > > > lResult = Application.InputBox(String(i, "x"), "title", 10,

    Type:=1)
    > > > Next
    > > >
    > > > PAST1:
    > > > MsgBox i, , "maximum prompt length with Application.InputBox"
    > > > MsgBox i, , "maximum prompt length with Application.InputBox"
    > > >
    > > > On Error GoTo PAST2
    > > > For i = 200 To 10000
    > > > SendKeys "{ENTER}", False
    > > > strResult = InputBox(String(i, "x"), "title", "a")
    > > > Next
    > > >
    > > > PAST2:
    > > > MsgBox i, , "maximum prompt length with InputBox"
    > > > MsgBox i, , "maximum prompt length with InputBox"
    > > >
    > > > End Sub
    > > >
    > > > Haven't found the maximum yet with the regular InputBox, but it is

    much
    > > > more.
    > > >
    > > > Is this is a known problem? I suppose it is.
    > > > Is there a workaround? I suppose not.
    > > >
    > > > RBS

    > >
    > > --
    > >
    > > Dave Peterson

    >
    > --
    >
    > Dave Peterson




  9. #9
    Dave Peterson
    Guest

    Re: Maximum length Prompt in Application.InputBox

    Thank you for your support! <bg>

    (It's still more fun to answer the question I read--not the question that was
    written!)

    Tom Ogilvy wrote:
    >
    > RTP <g>
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    > "Dave Peterson" <petersod@verizonXSPAM.net> wrote in message
    > news:43EBA121.CBA5F0E3@verizonXSPAM.net...
    > > It looks like the VBA inputbox is 254 characters.
    > >
    > > Please ignore the previous message.
    > >
    > >
    > >
    > > Dave Peterson wrote:
    > > >
    > > > And if you're really concerned about the length of the string returned,

    > why use
    > > > application.inputbox at all.
    > > >
    > > > You're probably not getting a number, formula, range, ....
    > > >
    > > > RB Smissaert wrote:
    > > > >
    > > > > Was caught out by the fact that the maximum length of the Prompt in
    > > > > Application.InputBox is much less than in the
    > > > > regular InputBox. The trouble was that the error you get is Runtime

    > error
    > > > > 13: Type mismatch, so I was looking at the
    > > > > datatypes of the different arguments, but the trouble is not with

    > those.
    > > > > The other trouble was that this seems to be mentioned nowhere.
    > > > >
    > > > > It looks the maximum lenght of the Prompt with Application.InputBox is

    > 256:
    > > > >
    > > > > Sub test()
    > > > >
    > > > > Dim i As Long
    > > > > Dim lResult As Long
    > > > > Dim strResult As String
    > > > >
    > > > > On Error GoTo PAST1
    > > > > For i = 245 To 400
    > > > > SendKeys "{ENTER}", False
    > > > > lResult = Application.InputBox(String(i, "x"), "title", 10,

    > Type:=1)
    > > > > Next
    > > > >
    > > > > PAST1:
    > > > > MsgBox i, , "maximum prompt length with Application.InputBox"
    > > > > MsgBox i, , "maximum prompt length with Application.InputBox"
    > > > >
    > > > > On Error GoTo PAST2
    > > > > For i = 200 To 10000
    > > > > SendKeys "{ENTER}", False
    > > > > strResult = InputBox(String(i, "x"), "title", "a")
    > > > > Next
    > > > >
    > > > > PAST2:
    > > > > MsgBox i, , "maximum prompt length with InputBox"
    > > > > MsgBox i, , "maximum prompt length with InputBox"
    > > > >
    > > > > End Sub
    > > > >
    > > > > Haven't found the maximum yet with the regular InputBox, but it is

    > much
    > > > > more.
    > > > >
    > > > > Is this is a known problem? I suppose it is.
    > > > > Is there a workaround? I suppose not.
    > > > >
    > > > > RBS
    > > >
    > > > --
    > > >
    > > > Dave Peterson

    > >
    > > --
    > >
    > > Dave Peterson


    --

    Dave Peterson

  10. #10
    Tom Ogilvy
    Guest

    Re: Maximum length Prompt in Application.InputBox

    You were persistent. I will give you that <g>


    --
    Regards,
    Tom Ogilvy

    "Dave Peterson" <petersod@verizonXSPAM.net> wrote in message
    news:43EBC5FE.6C30CBA8@verizonXSPAM.net...
    > Thank you for your support! <bg>
    >
    > (It's still more fun to answer the question I read--not the question that

    was
    > written!)
    >
    > Tom Ogilvy wrote:
    > >
    > > RTP <g>
    > >
    > > --
    > > Regards,
    > > Tom Ogilvy
    > >
    > > "Dave Peterson" <petersod@verizonXSPAM.net> wrote in message
    > > news:43EBA121.CBA5F0E3@verizonXSPAM.net...
    > > > It looks like the VBA inputbox is 254 characters.
    > > >
    > > > Please ignore the previous message.
    > > >
    > > >
    > > >
    > > > Dave Peterson wrote:
    > > > >
    > > > > And if you're really concerned about the length of the string

    returned,
    > > why use
    > > > > application.inputbox at all.
    > > > >
    > > > > You're probably not getting a number, formula, range, ....
    > > > >
    > > > > RB Smissaert wrote:
    > > > > >
    > > > > > Was caught out by the fact that the maximum length of the Prompt

    in
    > > > > > Application.InputBox is much less than in the
    > > > > > regular InputBox. The trouble was that the error you get is

    Runtime
    > > error
    > > > > > 13: Type mismatch, so I was looking at the
    > > > > > datatypes of the different arguments, but the trouble is not with

    > > those.
    > > > > > The other trouble was that this seems to be mentioned nowhere.
    > > > > >
    > > > > > It looks the maximum lenght of the Prompt with

    Application.InputBox is
    > > 256:
    > > > > >
    > > > > > Sub test()
    > > > > >
    > > > > > Dim i As Long
    > > > > > Dim lResult As Long
    > > > > > Dim strResult As String
    > > > > >
    > > > > > On Error GoTo PAST1
    > > > > > For i = 245 To 400
    > > > > > SendKeys "{ENTER}", False
    > > > > > lResult = Application.InputBox(String(i, "x"), "title", 10,

    > > Type:=1)
    > > > > > Next
    > > > > >
    > > > > > PAST1:
    > > > > > MsgBox i, , "maximum prompt length with Application.InputBox"
    > > > > > MsgBox i, , "maximum prompt length with Application.InputBox"
    > > > > >
    > > > > > On Error GoTo PAST2
    > > > > > For i = 200 To 10000
    > > > > > SendKeys "{ENTER}", False
    > > > > > strResult = InputBox(String(i, "x"), "title", "a")
    > > > > > Next
    > > > > >
    > > > > > PAST2:
    > > > > > MsgBox i, , "maximum prompt length with InputBox"
    > > > > > MsgBox i, , "maximum prompt length with InputBox"
    > > > > >
    > > > > > End Sub
    > > > > >
    > > > > > Haven't found the maximum yet with the regular InputBox, but it is

    > > much
    > > > > > more.
    > > > > >
    > > > > > Is this is a known problem? I suppose it is.
    > > > > > Is there a workaround? I suppose not.
    > > > > >
    > > > > > RBS
    > > > >
    > > > > --
    > > > >
    > > > > Dave Peterson
    > > >
    > > > --
    > > >
    > > > Dave Peterson

    >
    > --
    >
    > Dave Peterson




  11. #11
    Dave Peterson
    Guest

    Re: Maximum length Prompt in Application.InputBox

    Like a dog with a poisoned bone???



    Tom Ogilvy wrote:
    >
    > You were persistent. I will give you that <g>
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    > "Dave Peterson" <petersod@verizonXSPAM.net> wrote in message
    > news:43EBC5FE.6C30CBA8@verizonXSPAM.net...
    > > Thank you for your support! <bg>
    > >
    > > (It's still more fun to answer the question I read--not the question that

    > was
    > > written!)
    > >
    > > Tom Ogilvy wrote:
    > > >
    > > > RTP <g>
    > > >
    > > > --
    > > > Regards,
    > > > Tom Ogilvy
    > > >
    > > > "Dave Peterson" <petersod@verizonXSPAM.net> wrote in message
    > > > news:43EBA121.CBA5F0E3@verizonXSPAM.net...
    > > > > It looks like the VBA inputbox is 254 characters.
    > > > >
    > > > > Please ignore the previous message.
    > > > >
    > > > >
    > > > >
    > > > > Dave Peterson wrote:
    > > > > >
    > > > > > And if you're really concerned about the length of the string

    > returned,
    > > > why use
    > > > > > application.inputbox at all.
    > > > > >
    > > > > > You're probably not getting a number, formula, range, ....
    > > > > >
    > > > > > RB Smissaert wrote:
    > > > > > >
    > > > > > > Was caught out by the fact that the maximum length of the Prompt

    > in
    > > > > > > Application.InputBox is much less than in the
    > > > > > > regular InputBox. The trouble was that the error you get is

    > Runtime
    > > > error
    > > > > > > 13: Type mismatch, so I was looking at the
    > > > > > > datatypes of the different arguments, but the trouble is not with
    > > > those.
    > > > > > > The other trouble was that this seems to be mentioned nowhere.
    > > > > > >
    > > > > > > It looks the maximum lenght of the Prompt with

    > Application.InputBox is
    > > > 256:
    > > > > > >
    > > > > > > Sub test()
    > > > > > >
    > > > > > > Dim i As Long
    > > > > > > Dim lResult As Long
    > > > > > > Dim strResult As String
    > > > > > >
    > > > > > > On Error GoTo PAST1
    > > > > > > For i = 245 To 400
    > > > > > > SendKeys "{ENTER}", False
    > > > > > > lResult = Application.InputBox(String(i, "x"), "title", 10,
    > > > Type:=1)
    > > > > > > Next
    > > > > > >
    > > > > > > PAST1:
    > > > > > > MsgBox i, , "maximum prompt length with Application.InputBox"
    > > > > > > MsgBox i, , "maximum prompt length with Application.InputBox"
    > > > > > >
    > > > > > > On Error GoTo PAST2
    > > > > > > For i = 200 To 10000
    > > > > > > SendKeys "{ENTER}", False
    > > > > > > strResult = InputBox(String(i, "x"), "title", "a")
    > > > > > > Next
    > > > > > >
    > > > > > > PAST2:
    > > > > > > MsgBox i, , "maximum prompt length with InputBox"
    > > > > > > MsgBox i, , "maximum prompt length with InputBox"
    > > > > > >
    > > > > > > End Sub
    > > > > > >
    > > > > > > Haven't found the maximum yet with the regular InputBox, but it is
    > > > much
    > > > > > > more.
    > > > > > >
    > > > > > > Is this is a known problem? I suppose it is.
    > > > > > > Is there a workaround? I suppose not.
    > > > > > >
    > > > > > > RBS
    > > > > >
    > > > > > --
    > > > > >
    > > > > > Dave Peterson
    > > > >
    > > > > --
    > > > >
    > > > > Dave Peterson

    > >
    > > --
    > >
    > > Dave Peterson


    --

    Dave Peterson

  12. #12
    Dave Peterson
    Guest

    Re: Maximum length Prompt in Application.InputBox

    Like a dog with a poisoned bone???



    Tom Ogilvy wrote:
    >
    > You were persistent. I will give you that <g>
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    > "Dave Peterson" <petersod@verizonXSPAM.net> wrote in message
    > news:43EBC5FE.6C30CBA8@verizonXSPAM.net...
    > > Thank you for your support! <bg>
    > >
    > > (It's still more fun to answer the question I read--not the question that

    > was
    > > written!)
    > >
    > > Tom Ogilvy wrote:
    > > >
    > > > RTP <g>
    > > >
    > > > --
    > > > Regards,
    > > > Tom Ogilvy
    > > >
    > > > "Dave Peterson" <petersod@verizonXSPAM.net> wrote in message
    > > > news:43EBA121.CBA5F0E3@verizonXSPAM.net...
    > > > > It looks like the VBA inputbox is 254 characters.
    > > > >
    > > > > Please ignore the previous message.
    > > > >
    > > > >
    > > > >
    > > > > Dave Peterson wrote:
    > > > > >
    > > > > > And if you're really concerned about the length of the string

    > returned,
    > > > why use
    > > > > > application.inputbox at all.
    > > > > >
    > > > > > You're probably not getting a number, formula, range, ....
    > > > > >
    > > > > > RB Smissaert wrote:
    > > > > > >
    > > > > > > Was caught out by the fact that the maximum length of the Prompt

    > in
    > > > > > > Application.InputBox is much less than in the
    > > > > > > regular InputBox. The trouble was that the error you get is

    > Runtime
    > > > error
    > > > > > > 13: Type mismatch, so I was looking at the
    > > > > > > datatypes of the different arguments, but the trouble is not with
    > > > those.
    > > > > > > The other trouble was that this seems to be mentioned nowhere.
    > > > > > >
    > > > > > > It looks the maximum lenght of the Prompt with

    > Application.InputBox is
    > > > 256:
    > > > > > >
    > > > > > > Sub test()
    > > > > > >
    > > > > > > Dim i As Long
    > > > > > > Dim lResult As Long
    > > > > > > Dim strResult As String
    > > > > > >
    > > > > > > On Error GoTo PAST1
    > > > > > > For i = 245 To 400
    > > > > > > SendKeys "{ENTER}", False
    > > > > > > lResult = Application.InputBox(String(i, "x"), "title", 10,
    > > > Type:=1)
    > > > > > > Next
    > > > > > >
    > > > > > > PAST1:
    > > > > > > MsgBox i, , "maximum prompt length with Application.InputBox"
    > > > > > > MsgBox i, , "maximum prompt length with Application.InputBox"
    > > > > > >
    > > > > > > On Error GoTo PAST2
    > > > > > > For i = 200 To 10000
    > > > > > > SendKeys "{ENTER}", False
    > > > > > > strResult = InputBox(String(i, "x"), "title", "a")
    > > > > > > Next
    > > > > > >
    > > > > > > PAST2:
    > > > > > > MsgBox i, , "maximum prompt length with InputBox"
    > > > > > > MsgBox i, , "maximum prompt length with InputBox"
    > > > > > >
    > > > > > > End Sub
    > > > > > >
    > > > > > > Haven't found the maximum yet with the regular InputBox, but it is
    > > > much
    > > > > > > more.
    > > > > > >
    > > > > > > Is this is a known problem? I suppose it is.
    > > > > > > Is there a workaround? I suppose not.
    > > > > > >
    > > > > > > RBS
    > > > > >
    > > > > > --
    > > > > >
    > > > > > Dave Peterson
    > > > >
    > > > > --
    > > > >
    > > > > Dave Peterson

    > >
    > > --
    > >
    > > Dave Peterson


    --

    Dave Peterson

  13. #13
    Registered User
    Join Date
    05-27-2009
    Location
    Cincinnati, Ohio
    MS-Off Ver
    Excel 2002
    Posts
    1

    Re: Maximum length Prompt in Application.InputBox

    What about using the Interaction.InputBox method. The only problem, it doesn't provide a way to know which button was clicked on, but rather if "Cancel" was clicked on, returns an empty string (""), otherwise, returns the string that in the input box, which can also include an empty string. It allows for up to about 1024 characters for the Prompt argument.

  14. #14
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Maximum length Prompt in Application.InputBox

    Quote Originally Posted by Dodgester View Post
    What about using the Interaction.InputBox method. The only problem, it doesn't provide a way to know which button was clicked on, but rather if "Cancel" was clicked on, returns an empty string (""), otherwise, returns the string that in the input box, which can also include an empty string.
    You can tell the difference by using StrPtr on the variable you store the return in. If it's 0, then Cancel was pressed. This thread is fairly old though so I doubt anyone is still following it.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

+ 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