Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Tom,
I got your help in locating shapes in VBA. I need to return the located shape so I modified it into a function. But whenver I step into this line "findOval = shp", it just jumps out of the function without returning any shape. Do you have any suggestions? Thanks. This is your original code: Sub DD() Dim shp As Shape Dim s As String Dim TargetText As String TargetText = "dog" For Each shp In ActiveSheet.Shapes On Error Resume Next s = "" s = shp.TextFrame.Characters.Text On Error GoTo 0 If InStr(1, s, TargetText, vbTextCompare) Then shp.Select Exit For End If Next End Sub And this is what I modified: Function findOval(TargetText As String) Dim shp As Shape Dim s As String For Each shp In ActiveSheet.Shapes On Error Resume Next s = "" s = shp.TextFrame.Characters.Text On Error GoTo 0 If InStr(1, s, TargetText, vbTextCompare) Then shp.Select findOval = shp Exit For End If Next End Function |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
my curser changed from arrow shape to a cross shape???? | New Users to Excel | |||
Urgent - Pl help code for assigning a shape to cells | Excel Programming | |||
Open Folder - Ogilvy code | Excel Programming | |||
Assign code to shape | Excel Programming | |||
Deleting a shape and the cell contents the shape is in. | Excel Programming |