LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 66
Default Comparing Object References

Is there a way in VBA to compare Object References?

Consider the following

Option Explicit
Dim WBArray(1 To 1) As Workbook

Public Sub assign()
Set WBArray(1) = ActiveWorkbook
End Sub

Public Sub test()
If WBArray(1) = ActiveWorkbook Then
MsgBox "Yes"
Else
MsgBox "No"
End If
End Sub

Functionally, I want to make an AddIn with a class module that captures
Application events, but I only want to execute the code for those events on
workbooks that the user has told me are part of my application. So, I was
considering having the user tell me which workbooks are "mine" and in the
event handlers, the first thing I do is check to see if the event causing
workbook is in the list. I was hoping to not have to manage names or other
user definable properties.

Above, in test(), I functionally want to compare the object reference in the
array against the object reference for ActiveWorkbook to see if they refer to
the same object.

Is this something I can do in VBA? (Excel 2003) I could capture the
workbook.name property, and track changes to the name, but I was hoping to
avoid that.

Bob

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Object Library References Fox via OfficeKB.com Excel Programming 0 May 25th 06 07:49 PM
Comparing lists of map references simonralph Excel Worksheet Functions 0 April 8th 05 01:18 PM
Object Library References Nelson[_5_] Excel Programming 5 December 10th 03 08:54 PM
Object Library References Nelson[_6_] Excel Programming 1 December 10th 03 03:31 AM
Drawing object references JASon Excel Programming 2 August 28th 03 10:49 PM


All times are GMT +1. The time now is 07:36 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"