Outlook Startup Problem using Macros

G

Guest

Hi All,

I am trying to use macros in Outlook.

To get around the opening prompt about enabling macros, I digitally signed my Outlook VBA project using selfcert.exe.

Now I'm getting the message:

"Outlook experienced a serious error the last time the add-in 'microsoft vba for outlook' was opened. Would you like to disable the add-in? To reactivate this add-in, click About Microsoft's Office Outlook in the Help menu and then click disable items."

When I follow the procedure specified by the message I see the following disabled:

Outlook synchronization: sbcmsvnc.dll
microsoft vba for outlook add-in: outvba.dll

I enable them, but then it happens again when I close and re-open Outlook.

Does anyone know what's happening? Thanks.
 
K

Ken Slovak - [MVP - Outlook]

Not without seeing what you code is and does. It might be a code problem. Do
your symptoms go away if your code doesn't run?




Michael Ryle said:
Hi All,

I am trying to use macros in Outlook.

To get around the opening prompt about enabling macros, I digitally signed
my Outlook VBA project using selfcert.exe.
Now I'm getting the message:

"Outlook experienced a serious error the last time the add-in 'microsoft
vba for outlook' was opened. Would you like to disable the add-in? To
reactivate this add-in, click About Microsoft's Office Outlook in the Help
menu and then click disable items."
 
K

Ken Slovak - [MVP - Outlook]

In Outlook VBA code never instantiate an Outlook.Application object, use the
intrinsic Application object that is provided to you. That already will
provide all the Application events in the ThisOutlookSession class module.
This also has the advantage of being trusted in Outlook 2003 VBA code and
any Outlook objects you instantiate that are derived from the intrinsic
Application object are also trusted and won't fire any security prompts.




Michael Ryle said:
Ken,

The offending code follows:

Dim myOlApp As New Outlook.Application Public WithEvents myOlItems As Outlook.Items

Private Sub Application_Startup()
MsgBox ("Startup")
Call Initialize_Item_Handler
End Sub

Public Sub Initialize_Item_Handler()
MsgBox ("Initialize")
Set myOlItems = _
myOlApp.GetNamespace("MAPI").GetDefaultFolder(olFolderCalendar).Items
End Sub

Its intent is to set up handlers for the addition, modification and
removal of appointment items. The code in these handlers doesn't do
anything at this point and won't until I get past this problem of the
initialization of the handler.
 
G

Guest

Ken,

That did the trick, thanks very much (this forum continues to save my bacon again and again).

BTW, the code that I used instantiating the application object came via cut and paste plus a few modifications from one of the OL help dialogs. Guess whoever wrote it didn't know either.

Thanks again and have a great Fourth.

--
Michael Ryle
North Eastham, MA


Ken Slovak - said:
In Outlook VBA code never instantiate an Outlook.Application object, use the
intrinsic Application object that is provided to you. That already will
provide all the Application events in the ThisOutlookSession class module.
This also has the advantage of being trusted in Outlook 2003 VBA code and
any Outlook objects you instantiate that are derived from the intrinsic
Application object are also trusted and won't fire any security prompts.




Michael Ryle said:
Ken,

The offending code follows:

Dim myOlApp As New Outlook.Application Public WithEvents myOlItems As Outlook.Items

Private Sub Application_Startup()
MsgBox ("Startup")
Call Initialize_Item_Handler
End Sub

Public Sub Initialize_Item_Handler()
MsgBox ("Initialize")
Set myOlItems = _
myOlApp.GetNamespace("MAPI").GetDefaultFolder(olFolderCalendar).Items
End Sub

Its intent is to set up handlers for the addition, modification and
removal of appointment items. The code in these handlers doesn't do
anything at this point and won't until I get past this problem of the
initialization of the handler.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top