![]() |
#18
|
|||
|
|||
![]() Quote:
Im still trying to read from the pointers. At least I got it working the way, that the function works when called from the macro creating the object. My mistake was, not destroying OTemp. That I do now with one more line: Code:
Function ObjectFromPointer(lPtr As Long) As Object Dim oTemp As Object Mem_Copy oTemp, lPtr, 4 Set ObjectFromPointer = oTemp Mem_Copy oTemp, 0&, 4 End Function Code:
Sub ExampleForObject2() Dim objRange As Object Set objRange = Sheets(1).Range("A1") lng_ObjPtr = ObjPtr(objRange) If ObjectFromPointer(lng_ObjPtr) Is Nothing Then MsgBox "Object is Nothing" Else MsgBox "Object exists" End If 'Set objRange = Nothing End Sub Code:
Sub ObjectIsGone2() If ObjectFromPointer(lng_ObjPtr) Is Nothing Then MsgBox "Object is Nothing" Else MsgBox "Object exists" End If End Sub Crashing at the point Mem_Copy oTemp, lPtr, 4 in the function. Even with changing oTemp declared as Variant, it can't be done. So what else can be behind the pointer??? There's a chance that the address get's occupied of something else, but what can that be, you can't address to a variant? |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Wierd "script code" in a downloaded .doc file | CNBarnes | Word | 2 | 10-18-2012 02:07 AM |
![]() |
krishnaoptif | Word VBA | 9 | 06-22-2012 05:08 AM |
![]() |
Jamal NUMAN | Word | 2 | 07-03-2011 03:11 AM |
Rules and Alerts: "run a script"? | discountvc | Outlook | 0 | 06-15-2010 07:36 AM |
An "error has occurred in the script on this page" | decann | Outlook | 8 | 09-03-2009 08:54 AM |