[COLOR=darkblue]Dim[/COLOR] oOleObj [COLOR=darkblue]As[/COLOR] OLEObject
[COLOR=darkblue]Dim[/COLOR] wbOpen [COLOR=darkblue]As[/COLOR] Workbook
[COLOR=darkblue]Dim[/COLOR] sProgID [COLOR=darkblue]As[/COLOR] [COLOR=darkblue]String[/COLOR]
[COLOR=darkblue]For[/COLOR] [COLOR=darkblue]Each[/COLOR] oOleObj [COLOR=darkblue]In[/COLOR] ActiveSheet.OLEObjects
[COLOR=darkblue]If[/COLOR] oOleObj.OLEType = xlOLEEmbed [COLOR=darkblue]Then[/COLOR]
[COLOR=darkblue]On[/COLOR] [COLOR=darkblue]Error[/COLOR] [COLOR=darkblue]Resume[/COLOR] [COLOR=darkblue]Next[/COLOR]
sProgID = oOleObj.progID
[COLOR=darkblue]On[/COLOR] [COLOR=darkblue]Error[/COLOR] [COLOR=darkblue]GoTo[/COLOR] 0
[COLOR=darkblue]If[/COLOR] Len(sProgID) > 0 [COLOR=darkblue]Then[/COLOR]
[COLOR=darkblue]If[/COLOR] Left(oOleObj.progID, 5) = "Excel" [COLOR=darkblue]Then[/COLOR]
oOleObj.Verb xlVerbOpen
[COLOR=darkblue]Set[/COLOR] wbOpen = oOleObj.Object
[COLOR=green]'do stuff[/COLOR]
'
[COLOR=green]'[/COLOR]
wbOpen.Close SaveChanges:=[COLOR=darkblue]False[/COLOR]
[COLOR=darkblue]End[/COLOR] [COLOR=darkblue]If[/COLOR]
sProgID = vbNullString
[COLOR=darkblue]End[/COLOR] [COLOR=darkblue]If[/COLOR]
[COLOR=darkblue]End[/COLOR] [COLOR=darkblue]If[/COLOR]
[COLOR=darkblue]Next[/COLOR] oOleObj