ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Return OLEObjects values or names - two examples (https://www.excelbanter.com/excel-programming/313034-return-oleobjects-values-names-two-examples.html)

DataFreakFromUtah

Return OLEObjects values or names - two examples
 
No question here, just a couple of procedure examples for the archive.


GET VALUES OF OLEObjects on worksheet
GET NAMES OF OLEObject Names on worksheet


Search criteria: Loop through OLEObjects and get values
Return OLEObjects values
List OLEObject Values List OLEObjects values
Get OLEObjects Values
Return OLEObjects names Get OLEOBjects names
OLEObjects name return OLEBObjects values return


Sub OLEObjectNamesReturn()

'Return all or any OLEObjects names to VB message box
Dim oleObj As OLEObject

For Each oleObj In ActiveSheet.OLEObjects
If TypeOf oleObj.Object Is MSForms.HTMLText Then
MsgBox "HTMLText: " & oleObj.Name
End If
Next

End Sub


Sub OLEObjectValueReturn()

'Return any or all OLEObjects values on active worksheet to active worksheet
Dim oleObj As OLEObject

For Each oleObj In ActiveSheet.OLEObjects
If TypeOf oleObj.Object Is MSForms.HTMLText Then
' MsgBox "HTMLText: " & oleObj.Object.Value
ActiveCell.Value = oleObj.Object.Value
ActiveCell.Offset(1, 0).Select
End If
Next

End Sub


All times are GMT +1. The time now is 03:37 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com