The current function I use to collect text InputBox can't accept more than 255 characters apparently, and I need to be able to collect more than that? Is there a parameter or different function I can use to increase this limit?
-
1Why an InputBox? A small form and textbox is nearly always a better idea. – Fionnuala Jun 03 '10 at 20:31
-
@Remou ~ because that takes a lot more code and is not always easy for the new developer to use, whereas InputBox is highly accessible. Otherwise +1 – jcolebrand Jun 03 '10 at 20:33
-
~ I don't think it will take a longer string, SOL... Follow @Remou's advice. – jcolebrand Jun 03 '10 at 20:34
3 Answers
To be pedantic, the Inputbox will let you type up to 255 characters, but it will only return 254 characters.
Beyond that, yes, you'll need to create a simple form with a textbox. Then just make a little "helper function" something like:
Function getBigInput(prompt As String) As String
frmBigInputBox.Caption = prompt
frmBigInputBox.Show
getBigInput = frmBigInputBox.txtStuff.Text
End Function
or something like that...

- 39,306
- 13
- 73
- 89
-
shouldn't this be in a label like this `frmBigInputBox.myLabel.caption = prompt` otherwise everything is in the top bar of the form/window. – mountainclimber11 Sep 11 '17 at 15:34
Thanks BradC for the info that. My final code was roughly as follows, I have a button that calls the form that I created and positions it a bit as I was having some issues with the form being in the wrong spot the everytime after the first time I used.
Sub InsertNotesAttempt()
NoteEntryForm.Show
With NoteEntryForm
.Top = 125
.Left = 125
End With
End Sub
The userform was a TextBox and two CommandButtons(Cancel and Ok). The code for the buttons was as follows:
Private Sub CancelButton_Click()
Unload NoteEntryForm
End Sub
Private Sub OkButton_Click()
Dim UserNotes As String
UserNotes = NotesInput.Text
Application.ScreenUpdating = False
If UserNotes = "" Then
NoteEntryForm.Hide
Exit Sub
End If
Worksheets("Notes").ListObjects("Notes").ListRows.Add (1)
Worksheets("Notes").Range("Notes").Cells(1, 1) = Date
Worksheets("Notes").Range("Notes").Cells(1, 2) = UserNotes
Worksheets("Notes").Range("Notes").Cells(1, 2).WrapText = True
' Crap fix to get the wrap to work. I noticed that after I inserted another row the previous rows
' word wrap property would kick in. So I just add in and delete a row to force that behaviour.
Worksheets("Notes").ListObjects("Notes").ListRows.Add (1)
Worksheets("Notes").Range("Notes").Item(1).Delete
NotesInput.Text = vbNullString
NotesInput.SetFocus ' Retains focus on text entry box instead of command button.
NoteEntryForm.Hide
Application.ScreenUpdating = True
End Sub

- 320
- 2
- 6
- 18
I don't have enough rep to comment, but in the sub form_load for the helper you can add:
me.AutoCenter = True
Outside of that form, you can do it like this:
NoteEntryForm.Show
Forms("NoteEntryForm").AutoCenter = True
My Access forms get all confused when I go from my two extra monitors at work to my one extra monitor at home, and are sometimes lost in the corner. This AutoCenter has made it into the form properties of every one of my forms.

- 23
- 2
-
2Welcome to the site! This does not attempt to answer the posted question, as you know, and should be a comment. [Please use Answers exclusively to answer the question](//meta.stackoverflow.com/q/92107). To critique or request clarification from an author, leave a comment below their post - you can always comment on your own posts, and once you have [sufficient reputation](//stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](//stackoverflow.com/help/privileges/comment). In the meantime, please do not use answers to post comments. – Mogsdad May 13 '16 at 14:05