extract values from text boxes (Solved)
EDIT: I figured out a way to do this, scroll down to the last post if interested...
so I have some text boxes on a worksheet, and I want to loop through and extract the data from each of them..
I could get it by
but this is kind of messy. plus the number of text boxes is dynamic
so I looked around on the net and found some code like:
now, as far as I can tell, this should work... the name gets printed ok, but when the "shape.TextFrame.Characters.Text" line is hit, I get an error message:
"run-time error '438':
object doesn't support this property or method"
which is kind of strange as I have found that particular coding on a couple of sites
(eg: http://exceltips.vitalnews.com/Pages/T1024_Placing_Textbox_Text_Into_a_Worksheet.html)
and VBE's autocomplete is happy with it.
can anyone point out what I'm doing wrong here as I'm close to tearing hair out... do I need to enable a particular reference or something like that?
thanks in advance,
Bogzla
EDIT: I figured out a way to do this, scroll down to the last post if interested...
so I have some text boxes on a worksheet, and I want to loop through and extract the data from each of them..
I could get it by
Code:
string = string & activesheet.txtBox1.Value
string = string & activesheet.txtBox2.value
etc
etc
so I looked around on the net and found some code like:
Code:
Dim shape As shape
For Each shape In ActiveSheet.Shapes
If Left(shape.Name, 3) = "txt" Then
Debug.Print shape.Name
Debug.Print shape.TextFrame.Characters.Text
End If
Next
"run-time error '438':
object doesn't support this property or method"
which is kind of strange as I have found that particular coding on a couple of sites
(eg: http://exceltips.vitalnews.com/Pages/T1024_Placing_Textbox_Text_Into_a_Worksheet.html)
and VBE's autocomplete is happy with it.
can anyone point out what I'm doing wrong here as I'm close to tearing hair out... do I need to enable a particular reference or something like that?
thanks in advance,
Bogzla
Last edited: