抽取图形中的文字,前面文章有提到,关注一下EXCEL中一个单元中的回车符
Chr10而非CHR13CHR10
放置文本框,按钮,单击事件代码如下:
Private Sub CommandButton1_Click()
Dim strret(1) As String
Dim strget, strtmp, strdd As String
strret(0) = ""
strret(1) = ""
strtmp = ""
strget = ""
Set ws = ActiveSheet
For Each sh In ws.Shapes
'strshow = strshow + sh.AlternativeText
On Error GoTo ConInner
cnt = cnt + 1
'whether the shape type is AutoShape
If sh.Type = msoAutoShape Then
'key process: get description from this AutoShape
'in order to skip line shape
If Len(sh.AlternativeText) > 0 Then
strget = sh.TextFrame.Characters.Caption
strget = Replace(strget, Chr(10), vbTab)
strdd = strdd + Chr(13) + Chr(10) + strget
End If
End If
ConInner:
Next
TextBox1.Text = strdd
End Sub