ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Reading a textbox ole/control (https://www.excelbanter.com/excel-programming/439997-reading-textbox-ole-control.html)

Mike H

Reading a textbox ole/control
 
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



All times are GMT +1. The time now is 09:15 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com