Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to overcome Inputbox 255-char limit?
Hi All:
I'd sure appreciate some help in finding a way to replace VBA's Inputbox because of its 255-char limit While running existing VBA code in Excel 2003, I display text on the screen using Inputbox, I need to do some small edits to the text and then press OKm then the VBA code takes this corrected text and goes on. The Problem is that Inputbox does not deal with long text, I sometimes need to display and edit 1000-char text. I have tried, unsuccessfully, to use a VBA textform (over my head I guess). Can some one please be so kind as to give me a clue as to how to solve my problem? Thanks so much, JS |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to overcome Inputbox 255-char limit?
You could design your own userform using labels or multipage and have almost
limitless space for text. "John Svendsen" wrote: Hi All: I'd sure appreciate some help in finding a way to replace VBA's Inputbox because of its 255-char limit While running existing VBA code in Excel 2003, I display text on the screen using Inputbox, I need to do some small edits to the text and then press OKm then the VBA code takes this corrected text and goes on. The Problem is that Inputbox does not deal with long text, I sometimes need to display and edit 1000-char text. I have tried, unsuccessfully, to use a VBA textform (over my head I guess). Can some one please be so kind as to give me a clue as to how to solve my problem? Thanks so much, JS |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to overcome Inputbox 255-char limit?
I have tried, unsuccessfully, to use a VBA textform (over my head I
guess). Maybe the following will get you started Add a userform, alt-i, u. If the Toolbox doesn't appear look for the spanner and hammer icon Add a Textbox named TextBox1 and two buttons named CommandButton1 & 2 (hover over the toolbox) double click the form or press F7 to access the userform's code module Private Sub CommandButton1_Click() ' this is the Cancel button ' in properties set Cancel=True Me.TextBox1.Text = "" Me.Hide End Sub Private Sub CommandButton2_Click() ' This is the OK button Me.Hide End Sub Insert a normal module and paste the following Sub EditText() Dim sTextOrig As String, sTextNew As String Dim frm As UserForm1 sText = "a whole bunch of text" sText = sText & vbLf & _ "use Ctrl-Enter to force new line but ensure, " sText = sText & "the Textbox's Multiline property is True" Set frm = New UserForm1 frm.TextBox1.Text = sText frm.Show vbModal sTextNew = frm.TextBox1.Text If Len(sTextNew) Then MsgBox sTextNew Else MsgBox "user cancelled" End If End Sub Go back to the form menu Select CommandButton1 In properties set Cancel = True and change the caption to "Cancel" Select CommandButton1 change the caption to "OK" Select Textbox1 change Multiline = True and Wrap = True (if not already) Switch back to the normal module, with the cursor in EditText() press F5 to run Regards, Peter T "John Svendsen" wrote in message ... Hi All: I'd sure appreciate some help in finding a way to replace VBA's Inputbox because of its 255-char limit While running existing VBA code in Excel 2003, I display text on the screen using Inputbox, I need to do some small edits to the text and then press OKm then the VBA code takes this corrected text and goes on. The Problem is that Inputbox does not deal with long text, I sometimes need to display and edit 1000-char text. I have tried, unsuccessfully, to use a VBA textform (over my head I guess). Can some one please be so kind as to give me a clue as to how to solve my problem? Thanks so much, JS |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to overcome Inputbox 255-char limit?
I forgot a detail (closing with the little x), try this instead (on the form
a textbox and 2 commandbuttons with properties as described before) '''''' userform code Public sNewText As String Private Sub CommandButton1_Click() ' this is the Cancel button ' in properties set Cancel=True Me.TextBox1.Text = "" Me.Hide End Sub Private Sub CommandButton2_Click() ' This is the OK button sNewText = Me.TextBox1.Text Me.Hide End Sub '''''' end userform code ' in a normal module Sub EditText() Dim sTextOrig As String, sTextNew As String Dim frm As UserForm1 sText = "a whole bunch of text" sText = sText & vbLf & _ "use Ctrl-Enter to force new line but ensure, " sText = sText & "the Textbox's Multiline property is True" Set frm = New UserForm1 frm.TextBox1.Text = sText frm.Show vbModal sTextNew = frm.sNewText 'extBox1.Text If Len(sTextNew) Then MsgBox sTextNew Else MsgBox "user cancelled" End If End Sub Regards, Peter T "Peter T" <peter_t@discussions wrote in message ... I have tried, unsuccessfully, to use a VBA textform (over my head I guess). Maybe the following will get you started Add a userform, alt-i, u. If the Toolbox doesn't appear look for the spanner and hammer icon Add a Textbox named TextBox1 and two buttons named CommandButton1 & 2 (hover over the toolbox) double click the form or press F7 to access the userform's code module Private Sub CommandButton1_Click() ' this is the Cancel button ' in properties set Cancel=True Me.TextBox1.Text = "" Me.Hide End Sub Private Sub CommandButton2_Click() ' This is the OK button Me.Hide End Sub Insert a normal module and paste the following Sub EditText() Dim sTextOrig As String, sTextNew As String Dim frm As UserForm1 sText = "a whole bunch of text" sText = sText & vbLf & _ "use Ctrl-Enter to force new line but ensure, " sText = sText & "the Textbox's Multiline property is True" Set frm = New UserForm1 frm.TextBox1.Text = sText frm.Show vbModal sTextNew = frm.TextBox1.Text If Len(sTextNew) Then MsgBox sTextNew Else MsgBox "user cancelled" End If End Sub Go back to the form menu Select CommandButton1 In properties set Cancel = True and change the caption to "Cancel" Select CommandButton1 change the caption to "OK" Select Textbox1 change Multiline = True and Wrap = True (if not already) Switch back to the normal module, with the cursor in EditText() press F5 to run Regards, Peter T "John Svendsen" wrote in message ... Hi All: I'd sure appreciate some help in finding a way to replace VBA's Inputbox because of its 255-char limit While running existing VBA code in Excel 2003, I display text on the screen using Inputbox, I need to do some small edits to the text and then press OKm then the VBA code takes this corrected text and goes on. The Problem is that Inputbox does not deal with long text, I sometimes need to display and edit 1000-char text. I have tried, unsuccessfully, to use a VBA textform (over my head I guess). Can some one please be so kind as to give me a clue as to how to solve my problem? Thanks so much, JS |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
combine multiple workbooks? overcome 255 character limit? | Excel Worksheet Functions | |||
255 char limit on TextBox | Excel Programming | |||
How do I get around the 255 char limit? | Links and Linking in Excel | |||
Pivot Table - Overcome col. limit? | Excel Programming | |||
Limit to 50 char only | Excel Programming |