Application failure in outlook 2003 following VBA macro

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi I have run in to the following problem, that took som time debugging:

if I write this

Dim olApp As Outlook.Application

Set olApp = CreateObject("Outlook.Application")

In a macro in outlook 2003. (I copyed it from the builtin help).

The macro runs fine, but when I later close outlook I get an Application
failure reason: 0xc0000005. that I enterpret as VBA trying to ilegally acces
memory.

Altering to:

Dim olApp As Outlook.Application

Set olApp = Outlook.Application

solves this problem.
 
That statement is unnecessary, since Outlook VBA supports a built-in Application object that you should be using instead, which is what your second version does.
 
Back
Top