Sub FindInShapes1()
Dim rStart As Range
Dim shp As Shape
Dim sFind As String
Dim sTemp As String
Dim Response
sFind = InputBox("Search for?")
If Trim(sFind) = "" Then
MsgBox "Nothing entered"
Exit Sub
End If
Set rStart = ActiveCell
For Each shp In ActiveSheet.Shapes
sTemp = shp.TextFrame.Characters.Text
If InStr(LCase(sTemp), LCase(sFind)) <> 0 Then
shp.Select
Response = MsgBox( _
prompt:=shp.TopLeftCell & vbCrLf & _
sTemp & vbCrLf & vbCrLf & _
"Do you want to continue?", _
Buttons:=vbYesNo, Title:="Continue?")
If Response <> vbYes Then
Set rStart = Nothing
Exit Sub
End If
End If
Next
MsgBox "No more found"
rStart.Select
Set rStart = Nothing
End Sub
你好,
我制作了上面的宏,用于在“拥挤”的工作表中查找 excel 形状,通过里面写的文本。该宏适用于任何新书,但不适用于我需要的书,它是否继续显示以下消息:
"Run-Time error '1004'
The specified value is out of range"
一旦我单击“调试”,它就会突出显示该行:
sTemp = shp.TextFrame.Characters.Text
怎么了?
感谢您的帮助基亚拉