LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 81
Default Accessing Mutiple TextBoxes

Hi Tim

Thankyou for the code Peter, i´ve added the Part which
reads out the Characters and addes them to the string.
The export now word fine (entire text is transferd) but
the carriage returns go missing and spaces are
represented as "squares". Any solution to this ?


In my testing (Excel only) the combination vbcr & cblf
returned proper paragraphs with a line spaced between. If
you are programmatically writing text later to be copied
to another App, try this:
SomeText & chr(13) & chr(10) & moreText


General question: You have helped with the TextBoxes
from the drawing menu. When using the TextBox Control
from the controls menu the entire text including the
formating is transfer automatically into my ACCESS 97
Memo field. If I could address the TextBox controls then
these problem won´t occur. My Textbox Contols are placed
directly on the Worksheet and not in a UserForm therfore
haven´t been able to address them.
In which container Object are they included ?


To return text from a controls textbox try this:

Sub test4()
Dim sName As String, MyText As String
Dim ws As Worksheet
sName = "TextBox1"
Set ws = ActiveSheet
' with a controls textbox named "TextBox1" in the
' names dropdown (left of inputbar)

MyText = ws.OLEObjects(sName).Object.Text
Debug.Print MyText
End Sub

I recall in your first post you were returning text this
way:
Text = Worksheets(TableName).Comment.Text

I assume you had renamed the CodeName of your textbox
as "Comment" in Properties. This is independently named to
it's OLEObject name, that you see in the dropdown Names
list to left of the input bar (in design mode)

I don't know how to directly refer to an OLEObject by its
Codename other than a long winded method something like
this:

Sub test5()
Dim obj As OLEObject
Dim oTB As MSForms.TextBox
Dim MyText As String
Dim ws As Worksheet
Set ws = ActiveSheet
'with a controls Texbox named "Comment" in Properties
For Each obj In ws.OLEObjects
If TypeOf obj.Object Is MSForms.TextBox Then
Set oTB = obj.Object
If oTB.Name = "Comment" Then
MyText = oTB.Text
MsgBox MyText
Exit For
End If
End If
Next
End Sub

Above is even more long winded than needs be to
demonstrate MSForms.TextBox. But if anyone knows a more
direct method to refer to an OLEObject's CodeName I'd also
be interested.

Regards,
Peter
 
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
Running mutiple excel sheets on mutiple computers Lost Excel Discussion (Misc queries) 3 January 16th 09 12:32 AM
tab between several textboxes Kim Excel Worksheet Functions 0 May 9th 05 04:08 PM
Accessing Mutiple TextBoxes TimBro[_3_] Excel Programming 1 October 1st 04 05:56 PM
Accessing Mutiple TextBoxes TimBro[_2_] Excel Programming 0 October 1st 04 03:16 PM
Accessing Mutiple TextBoxes TimBro Excel Programming 1 October 1st 04 01:57 PM


All times are GMT +1. The time now is 09:32 AM.

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

About Us

"It's about Microsoft Excel"