Forum Discussion
Access of Text in an Excel Autoshape with vba
How can I access Text in an Excel Autoshape with vba (see worksheet in attached file)?
15 Replies
- ber999Brass Contributor
Hi,
thank you for the notice. The error message is "Der
angegebene Wert ist außerhalb des zulässigen Bereichs."I did see the screenshot (and I understand German), but that doesn't help. I'd need to see (a copy of) the workbook.
- ber999Brass Contributor
Hi Hans,
I have tested the my code with the worksheet and the single Autoshape. And, it works. Consequently, the problem should be the structure of the worksheet. However, the worksheet in question is not for public use. So, I will try to find a solution.
For example:
Dim strText As String strText = ActiveSheet.Shapes(1).TextFrame2.TextRange.Text
If you know the name of the shape, you can use that: change Shapes(1) to Shapes("Flussdiagramm: Prozess 1")
- ber999Brass Contributor
Hi Hans,
this is the interesting part of the code I have used:
.
Dim exlShpOuter As Excel.Shape
.
.
Set exlWssrc=ActiveWorkbook.Worksheets.Item("AS")
.
For Each exlShpOuter In exlWsSrc.Shapes
Select Case exlShpOuter.Type
Case Office.msoLine
Case Office.msoGroup
..
Case Else
.vbaText = exlShpOuter.TextFrame2.TextRange.Text
.
.
The error messagebox is attached.
- ber999Brass Contributor
Hallo Hans,
thank you very much. I have found this method at several places in the internet. But, why does not work?
Do you get an error message? If so, what does it say?