View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
OssieMac OssieMac is offline
external usenet poster
 
Posts: 2,510
Default Data from sheet, through userform to text box on the sheet.

Hi Lucas,

Not sure if any of this will help but I'll make the suggestions anyway.

First of all I suggest that you use Nick's code method but perhaps with a
modification of using the sheet name in lieu of ActiveSheet. That way you do
not have to ensure that the sheet is the selected sheet.

Next try saving the data to info after creating the text box.

If still failing insert a MsgBox to display the length of the info string
and that will isolate the problem to either info is not accepting the data or
the TextBox is not accepting the data.

I was not able to get either your code or Nick's code to fail and I tested
with up to 1,500 characters so also give some thought to Nick's questions in
his last post.

Dim sp As Shape
Dim info As String

Set sp = Sheets("Sheet1").Shapes.AddTextbox _
(msoTextOrientationHorizontal, _
left1, Top1, Width1, Height_box)

'Save data to info after creating the TextBox
info = UserForm1.TextBox1.Value

MsgBox Len(info) 'Check that info has a string

With sp
.Name = "myBox"
.TextFrame.Characters.Text = info
End With

--
Regards,

OssieMac