Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to access the text inside "Text Box 1", copy it and then paste it into a range beginning at A37.

UPDATE: the text boxes in question are simple text boxes that have been inserted using: Insert Tab > Text box button.

Below is a shambles of things I'm experimenting with. I can't seem to find the way to get at the text and copy it. Any ideas?

Sub textbox()

    Dim txBox As Shape
    Set txBox = ActiveSheet.Shapes("Text Box 1")
    'shpTextBox.selStart = 0
    'shpTextBox.SelLength = Len(shpTextBox.Text)

    txBox.Select
    txBox.TextFrame.Characters.Text
    Range("A37").Value = shpTextBox.Value    

End Sub
share|improve this question

1 Answer 1

up vote 1 down vote accepted

This works when I try it:

Dim txBox As Shape
Set txBox = ActiveSheet.Shapes("Text Box 1")

Range("A37").Value = txBox.TextFrame.Characters.Text
share|improve this answer
    
These text boxes already exist in the sheets I'm updating. They are simple text boxes inserted using the Insert Tab > Text box button. I think this may be why I'm running into the problems. –  RocketGoal Jul 4 '13 at 14:42
    
@RocketGoal: see updated answer –  James Jul 4 '13 at 15:31
    
It does what I couldn't make it do. Many thanks. –  RocketGoal Jul 5 '13 at 9:45

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.