Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA Userform Textbox help

Hi All,
This might sound like a dumb question (which it probably is) but can
someone help me with the below code?

I have a userform called NCCC1 and I want to copy the text (which is
over 255 characters) from the textbox to a cell. I am getting an
object required error message and I can only seem to find help for
copying from drawing textboxes not userform textboxes.
Is there a difference?

Private Sub btnSave_Click()

Application.ScreenUpdating = False
Dim r As Range
Dim b As Variant
Dim i As Integer

Set r = ActiveWorkbook.Worksheets("Comments1").Range("A1")
b = Me.txtbox1.Text
'--codes breaks here--
r.Value = b.Characters(1, 255).Text
For i = 256 To b.Characters.Count Step 255
r.Value = r.Value & b.Characters(i, 255).Text
Next i
r.WrapText = False

End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default VBA Userform Textbox help

Hi,

I may have misunderstood but if all you want to do is copy the contents of
the texbox tp A1 then this will do it:-

Private Sub CommandButton1_Click()
Dim r As Range
Set r = ActiveWorkbook.Worksheets("Comments1").Range("A1")
b = Me.TxtBox1.Text
r.Value = b
End Sub


Mike

"Joey_83" wrote:

Hi All,
This might sound like a dumb question (which it probably is) but can
someone help me with the below code?

I have a userform called NCCC1 and I want to copy the text (which is
over 255 characters) from the textbox to a cell. I am getting an
object required error message and I can only seem to find help for
copying from drawing textboxes not userform textboxes.
Is there a difference?

Private Sub btnSave_Click()

Application.ScreenUpdating = False
Dim r As Range
Dim b As Variant
Dim i As Integer

Set r = ActiveWorkbook.Worksheets("Comments1").Range("A1")
b = Me.txtbox1.Text
'--codes breaks here--
r.Value = b.Characters(1, 255).Text
For i = 256 To b.Characters.Count Step 255
r.Value = r.Value & b.Characters(i, 255).Text
Next i
r.WrapText = False

End Sub


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
Userform TextBox LaDdIe Excel Programming 4 August 11th 07 08:32 AM
Userform textbox help [email protected] Excel Programming 1 September 17th 06 08:27 AM
Textbox in userform Harald Staff Excel Programming 0 September 8th 04 11:51 AM
Textbox in userform shaharul[_6_] Excel Programming 3 April 15th 04 12:54 PM
UserForm TextBox to ActiveSheet TextBox over 256 characters Dan E[_2_] Excel Programming 1 July 28th 03 07:36 PM


All times are GMT +1. The time now is 12:36 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"