selecting range within embedded object

L

lance-news

Hey all,

I keep trying to select a range so I can do a search and replace but
I always get an object-defined error??



Sub test()
ActivePresentation.Slides(39).Select
Set SlideObject = ActivePresentation.Slides(39)

For Each ShapeObject In SlideObject.Shapes
If ShapeObject.Type = msoEmbeddedOLEObject Then
If Mid$(ShapeObject.OLEFormat.ProgID, 1, 11) =
"Excel.Sheet" Then
Set oXLBook = ShapeObject.OLEFormat.Object

'''''''''''''''This line is causing me grief '''''''''''''''''''''
oXLBook.Worksheets("Sheet1").Range("B4:O30").Select

Selection.Find(What:="<1%", After:=ActiveCell, LookIn:=xlFormulas,
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:=False, SearchFormat:=False).Activate

Selection.Replace What:="<1%", Replacement:="0", LookAt:=xlPart,
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False,
ReplaceFormat:=False


End If
End If
Next ShapeObject
End Sub
 
L

lance-news

(e-mail address removed) wrote:

Sub test()
ActivePresentation.Slides(39).Select
Set SlideObject = ActivePresentation.Slides(39)

For Each ShapeObject In SlideObject.Shapes
If ShapeObject.Type = msoEmbeddedOLEObject Then
If Mid$(ShapeObject.OLEFormat.ProgID, 1, 11) =
"Excel.Sheet" Then
Set oXLBook = ShapeObject.OLEFormat.Object

oXLBook.Worksheets("Sheet1").Cells.Replace What:="<1%",
Replacement:=".0005", LookAt:=xlPart, MatchCase:=False
oXLBook.Worksheets("Sheet1").Cells.Replace What:="- -",
Replacement:="0", LookAt:=xlPart, MatchCase:=False

oXLBook.Worksheets("Sheet1").Cells.Replace What:="0.05%",
Replacement:="<1%", LookAt:=xlPart, MatchCase:=False
oXLBook.Worksheets("Sheet1").Cells.Replace What:="0", Replacement:="-
-", LookAt:=xlPart, MatchCase:=False



End If
End If
Next ShapeObject
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top