InputBox function - prompt string limit

M

Marcotte A

Is there a limit on the size of the string you can pass to the prompt arg of InputBox? For some reason it is not displaying the last line of my menu. MsgBox works fine

Dim Answer2 as Varian
Dim HelpMenu As Strin
HelpMenu = vbCr & "1. Introduction" & vbCr & "2. Summary Pages"
& vbCr & "3. Store Pages" & vbCr & "4. Adding New Products/Stores"
& vbCr & "5. Exit
MsgBox HelpMenu 'this displays as expecte
Answer2 = Application.InputBox(Title:="Menu", prompt:="Enter the number of a "
& "menu item below." & HelpMenu
'this only displays the first 4 lines of HelpMenu. Option 5 doesn't appear, but I can still choose
'it and the code operates correctl

What am I missing here?
 
B

Bob Phillips

Marcotte,

I think that what is happening here is that the Inputbox dialog box is a
fixed size, The MsgBox dialog will size to the input, but as inputbox shows
a text input field, it places that in a fixed position, and the dialog box
is fixed around it.

You are not choosing the value 5, you are just inputting the value in the
box. You can just as easily enter 6 which isn't in the list.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

Marcotte A said:
Is there a limit on the size of the string you can pass to the prompt arg
of InputBox? For some reason it is not displaying the last line of my menu.
MsgBox works fine.
 
M

Marcotte A

Thanks Bob. I kind of figured it was a size/display issue. So there's no way to increase the dimensions of the InputBox

Oh, and I realize I'm just passing a number to the Answer2 variable, and the code would work if I didn't include the HelpMenu string, but entering 6 would be a bad idea because of this snippet of code

Select Case Answer
....
Case 6: system.selfdestruc
....
End Selec
;)
 
M

Marcotte A

Interesting note: The InputBox METHOD (ie Application.InputBox) is of fixed size; the InputBox FUNCTION seems to grow to fit 'prompt' (at least I got it to display 9 lines, as opposed to 5.)
 
M

Michel Pierron

Hi Marcotte A,
if I am not mistaken, the limit is 1024 characters.
MP
Marcotte A said:
Is there a limit on the size of the string you can pass to the prompt arg of
InputBox? For some reason it is not displaying the last line of my menu. MsgBox
works fine.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top