Home  |   French  |   About  |   Search  | mvps.org  

What's New
Table Of Contents
Credits
Netiquette
10 Commandments 
Bugs
Tables
Queries
Forms
Reports
Modules
APIs
Strings
Date/Time
General
Downloads
Resources
Search
Feedback
mvps.org

In Memoriam

Terms of Use


VB Petition

API: Access/Office and AddressOf Operator

Author(s)
Dev Ashish

   AddressOf is not supported in Access/Office 97 (or any previous version).  There's a good chance though, that it will be supported in VBA 6, or Office 2000.

    However, Ken Getz and Michael Kaplan, in Microsoft Office and VBA Developer Magazine, have published an undocumented method of getting the address (pointer) to a procedure in VBA environment.

    The AddressOf code is available at Trigeminal's website).   Try to get that particular issue (May, 1998) of the magazine to read the accompanying detailed article as well since there are a bunch of issues that you should be aware of.

    AddressOf, now a standard operator in VB 5, can be used to pass the address of a user defined function to an API function. This allows us to use several other APIs which require a callback function. This in turn allows us to subclass an Access form for additional functionality. (Subclassing is a technique that enables us to intercept Windows messages being sent to a form or control.)

Warnings:

  1. AddressOf is COMPLETELY UNSUPPORTED by Microsoft in Office 97 environment. Use it at your own risk!!
     
  2. Entering debug mode is not recommended as it is likely to cause problems (GPFs etc.). 
     
  3. Make sure you backup your work and save before running any such code.  Using this technique adds another level of instability since there are so many different ways to set up things wrong.  Once you get it to work properly, everything should be ok.
     
  4. Make sure you enter a On Error Resume Next at the top of any callback function. This is done to ensure that any errors within a callback function are not propagated back to its caller.
     
  5. Be careful of ByVal or ByRef when passing arguments to the function.   If you don't get this right, nothing's going to work.

 


© 1998-2010, Dev Ashish & Arvin Meyer, All rights reserved. Optimized for Microsoft Internet Explorer