Reading a textbox ole/control

M

Mike H

I'm trying to read and write text to all textboxes on a worksheet page. I
pulled off of a bunch of examples from this forum (including one of my own
threads) and nothing is working. Can someone verify if there is something
wrong with either of these methods below.
Note that at this point in the code the worksheet is open and I've already
read from objWS.cells. The page has two text boxes and two picture boxes, I
don't know if they are OLE or controls. Neither method executes the loop at
all. I'm using Excel 2003 and Windows 2000.

Method 1, read an OLE textbox:

For Each OLEObj In objWS.OLEObjects
BBStr = OLEObj.Object.Text
oIEDoc.Writeln BBStr
Next

Method 2, read a textbox control:

For K = 1 To 5
BBStr = ActiveSheet.Controls("TextBox" & K).Text
oIEDoc.Writeln BBStr
Next
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top