Unable to get TextBoxes property of Worksheet Class Error
A Name like "TextBox1" infers the default name for an ActiveX type Texbox.
The OP has already said they are not aX but from "the drawing tool".
Therefore the default naming style will be "TextBox 1" or "Text Box 1"
depending on the Excel version.
However there is something ambiguous in the OP's description which was the
point of my post.
Regards,
Peter T
"Skiffle" wrote in message
...
Estaup,
So you don't make a simple syntax error that is difficult to find; the
number of a control is specified immediately after its name with no space
between them.
.
For textboxes, the names are TextBox1, TextBox2; not TextBox 1, TextBox 2.
Notice, in the correct form, there is no space between 'TextBox' and the
number following it.
For the correct syntax, refer to JLGWhiz' second post.
Cheers,
Skiffle
"Estaup" wrote in message
...
I have posted elsewhere to try and get resolution on my issue and decided
to
ask for help here as well.
I have an issue that is driving me crazy. I have a workbook that has
multiple sheets and some of these sheets have Textboxes (from the drawing
tool) on the sheet with standard naming (i.e. TextBox 1, TextBox 2, etc.)
I have a button that executes code that takes and builds an external file
with the data from the worksheets, including the TextBoxes. During that
process I am checking to see if those worksheets with TextBoxes have
anything
entered before attempting to grab the contents and write them to the
external
file.
Here is the crazy part. If I open the workbook and without doing anything
else, click the button to process I get the 'Unable to get TextBoxes
property
of Worksheet Class' error message.
If I go to each of the sheets, and click to Add text in each of them,
then
click the button to process I do not get the error and everything is
fine.
Going nuts on this one.
The IF statement below is where the code breaks with the error:
If Len(Worksheets(2).TextBoxes("TextBox 2").Text) 0 Then
'I loop through grabing text out 255 characters at a time for processing
purposes
End If
Any help would be appreciated.
Thanks.
|