• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

How to capture values from ‘text box’.

ThrottleWorks

Excel Ninja
I have an excel file. In this file, we get few values in ‘text box’.
Basically this is an extract from website and pasted for further processing.
I am required to capture values from these boxes.
Is it possible. Can anyone please help me in this.

Please see attached file for more details.
 

Attachments

  • Book3.xlsx
    25.4 KB · Views: 9
Try this code:

Code:
Sub Extract_Text_Boxes()

Dim OLECont As OLEObject
For Each OLECont In Worksheets("Sheet1").OLEObjects
  If OLECont.progID = "Forms.HTML:Text.1" Then
  OLECont.TopLeftCell.Offset(0, 2) = OLECont.Object.Value
  End If
Next OLECont
 
End Sub

upload_2017-6-26_21-26-51.png
 
You can do something like below.
Code:
Sub Demo()
Dim obj As OLEObject

For Each obj In Sheet1.OLEObjects
    If TypeOf obj.Object Is MSForms.TextBox Then
        obj.TopLeftCell.Value = obj.Object.Value
        obj.Delete
    End If
Next

End Sub
 
Back
Top