[AccessD] Interesting VBA problem

Mark Simms marksimms at verizon.net
Thu Oct 17 20:00:31 CDT 2013


Unbelieveably I discovered it is IMPOSSIBLE to do.
However, it can be done if you "wrap" the calls with the old WSH library
(Windows Script Host)....that was built back in the days of VB6 (1999-2000).

Why on earth they never provided the same ability to dynamically name event
call backs in VB6 or VBA is baffling at best. It's another MSFT gaff I
believe. It's interesting to see that only now Bill Gates in some of his
interviews talks about all of the mistakes Microsoft made over the years.

Finally, I determined I don't really need the callback.
After I send the message, previously Outlook would close before it got out
of the outbox.
So now I place a call to Sleep 500 in a loop (5 times).
Worked a treat....call back needed no more.
I agree however that the callback is much safer and more reliable.



> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com [mailto:accessd-
> bounces at databaseadvisors.com] On Behalf Of Gustav Brock
> Sent: Wednesday, October 16, 2013 11:37 AM
> To: 'Access Developers discussion and problem solving'
> Subject: Re: [AccessD] Interesting VBA problem
>
> Hi John and Mark
>
> Oh, I missed that detail.
>
> The method applying a reference to the oldest acceptable version should
> work.
> If not, you could create a loop that tries to reference from the newest
> version and down until success. It should be enough to test for the
> Major
> version of the reference.
>
> /gustav
>
> -----Oprindelig meddelelse-----
> Fra: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] På vegne af John W Colby
> Sendt: 16. oktober 2013 17:12
> Til: Access Developers discussion and problem solving
> Emne: Re: [AccessD] Interesting VBA problem
>
> Gustav,
>
> But objects cannot be dimensioned withevents.
>
> It seems that Mark wants late binding but withevents... Withevents
> requires
> early binding
>
> I found this:
>
> http://stackoverflow.com/questions/12305736/late-binding-events
>
> Which discusses simply referencing the oldest possible version of the
> object
> (outlook in this case) that will ever be encountered. I have no idea
> whether
> this will actually work or not.
>
> It also means that you have to have that oldest version installed and
> we all
> know that outlook in particular wants to uninstall the older versions
> before
> installing later versions.  Issues like that.
>
> John W. Colby
>
> Reality is what refuses to go away
> when you do not believe in it
>
> On 10/16/2013 10:58 AM, Gustav Brock wrote:
> > Hi Mark
> >
> >      Dim oSync As Object
> >
> > ?
> >
> > /gustav
> >
> > -----Oprindelig meddelelse-----
> > Fra: accessd-bounces at databaseadvisors.com
> > [mailto:accessd-bounces at databaseadvisors.com] På vegne af Mark Simms
> > Sendt: 16. oktober 2013 14:45
> > Til: 'Access Developers discussion and problem solving'
> > Emne: [AccessD] Interesting VBA problem
> >
> > I've got an AC2010 app that must use late-binding.
> > I'm an instantiating an Outlook session.
> > However, I need to reference a SyncObject WithEvents.
> > However, what do I Dim it as ?
> > Private oSync WithEvents as Outlook.SyncObject
> >
> > Tried Private oSync WithEvents as EventObject By the compiler
> complained !
> >
> > Dim oSync as Access.CustomControl
> >
> > That worked, but the call back will probably fail, correct ?
> >
> > Someone said it might work if I:
> > Set oSync = CreateObject("Outlook.SyncObject")
>
>
>
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com




More information about the AccessD mailing list