Would like an auto adjusting InputBox

Posted on 2008-01-24
Medium Priority
Last Modified: 2010-04-21
Basically I have a script with one line like:
   variable = InputBox("some prompt", "some title")
which works fine for sinle line / single item entry.  However, what I'd like to have happen is that the box is capable of multiple line / item inputs as well.  So if there is only one item to process the action on, just enter the item name and click "ok".  If there are multiple items to process action on, simply enter them one line at time by pressing return after each (inputbox auomatically expands so you can see the list, or is scrollable -- then "ok" to finish.  Is this possible?  If so, how?
Question by:LawrenceBYork
LVL 65

Accepted Solution

RobSampson earned 500 total points
ID: 20738990

In short, no this is not possible with the standard input box, unless you ask the user how many items they want to enter, like so:
intItems = Int(InputBox("How many items do you want to enter?","Amount of Items","1"))
ReDim arrItems(intItems - 1)
For intItem = 0 To UBound(arrItems)
      arrItems(intItem) = InputBox("Please enter item number " & intItem + 1 & " of " & UBound(arrItems) + 1 & ":","Item Number " & intItem + 1 & " of " & UBound(arrItems) + 1)
MsgBox Join(arrItems, VbCrLf)

The only way to have a multi-line text box is to build a HTA.



Author Closing Comment

ID: 31424826
Unfortunately that's what I feared.  Ok, thanx!

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Issue: Unstable cursor in Windows XP and Windows runs extremely slow in that any click will bring up the Hour glass (sometimes for several seconds before giving you what you want) . Troubleshooting Process and the FINAL FIX: This issue see…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
SQL Database Recovery Software repairs the MDF & NDF Files, corrupted due to hardware related issues or software related errors. Provides preview of recovered database objects and allows saving in either MSSQL, CSV, HTML or XLS format. Ensures recov…
Suggested Courses

601 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question