Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
combine multiple workbooks? overcome 255 character limit? Wayne Excel Worksheet Functions 3 March 6th 09 08:38 PM
255 char limit on TextBox ep Excel Programming 3 July 8th 08 11:54 PM
How do I get around the 255 char limit? Dave H Links and Linking in Excel 3 June 13th 06 01:25 PM
Pivot Table - Overcome col. limit? No Name Excel Programming 4 December 30th 04 03:51 PM
Limit to 50 char only singkit Excel Programming 2 April 2nd 04 01:34 AM


All times are GMT +1. The time now is 03:41 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"