Excel VBA - Text Boxes

  • Thread starter Thread starter KD
  • Start date Start date
K

KD

Hi,

I am trying to copy all the contents of some text boxes
that appear on a worksheet on to a seperate worksheet but
without much luck.

I am trying to use a for each loop but cannot get it to
work when I need it to refernece the text boxes
individually.

Can anyone help me?

Many thanks
KD
 
for ActiveX textboxes

dim tbox as MSforms.Textbox
dim obj as OleObject
for each obj in Activesheet.OleObjects
if typeof obj.Object is MSforms.Textbox then
set tbox = obj.Object
' now work with your textbox
end if
Next

for Textboxes from the drawing toolbar

dim tbox as Textbox
for each tbox in Activesheet.Textboxes
' now work with your textboxes
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

Back
Top