A user of mine designed a bunch of Textboxes, Checkboxes. I am wondering is there a consistent way of extracting the content from that sheet? She used the default names (Textbox1 to TextboxX). The problem is that there are so many of the Textboxes and Checkboxes (around 400 of them) and I don't want to map each one. I was thinking of walking all the controls on the sheet and write them out instead of mapping them one by one. Something like below:
Will the For Each statement always be consistent of returning the data? What if I rearrange the Textboxes, will the sequence change?Sub LoopControls() Dim OleObj As OLEObject For Each OleObj In ActiveSheet.OLEObjects If OleObj.progID = "Forms.TextBox.1" Then MsgBox OleObj.Object.Text End If Next OleObj End Sub
What about is there something like Tabstop where I can assign like with forms??
Is there a better solution that any of you experts can give me?
Thanks.




Reply With Quote