Word Textbox into Excel

S

Stuart

Using Office 2000, I open a new document and then insert a
Textbox. I then copy and paste the textbox into a range in an
Excel worksheet.

How can I programmatically reference the textbox, please?

I've set a reference to MS Forms 2.0 in the Library

The following should work with an Excel ActiveX
textbox:

Sub Test()
Dim oleObj As OLEObject, rng As Range
With ActiveWorkbook
For Each oleObj In ActiveWorkbook.Sheets _
("Master Order").OLEObjects
If TypeOf oleObj.Object Is MSForms.TextBox Then
Set rng = oleObj.TopLeftCell
rng.Value = "Bingo"
End If
Next
End With
End Sub

Regards.
 
W

Word Heretic

G'day "Stuart" <[email protected]>,

Try iterating the fields collection looking for the correct type.

Steve Hudson - Word Heretic
Want a hyperlinked index? S/W R&D? See WordHeretic.com

steve from wordheretic.com (Email replies require payment)


Stuart reckoned:
 

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