Log in

View Full Version : Macros stop working after I restart Outlook. Why?!?



Sukotto
05-21-2007, 01:10 PM
I created a little VBscript to run a macro in Outlook 2000 (I'm stuck using this version).
The marco works every time I run it... while Outlook is open.

e.g.
In Outlook:

Sub helloworld()
MsgBox "Hello world"
End Sub


In c:\dev\helloworld.vbs:

dim outlookRef
Set outlookRef = CreateObject("OUTLOOK.APPLICATION")
outlookRef.helloworld
Set outlookRef = nothing


If I run helloworld.vbs I get the expected alert box. If I close, then reopen Outlook I get the error:

---------------------------
Windows Script Host
---------------------------
Script: C:\dev\helloworld.vbs
Line: 3
Char: 1
Error: Object doesn't support this property or method: 'helloworld'
Code: 800A01B6
Source: Microsoft VBScript runtime error
--------------------


The macro still exists and it still works if I run it from inside Outlook. But helloworld.vbs never works again.:banghead:

I have to delete c:\Documents and settings\sukotto\Application Data\Microsoft\Outlook\VBAProject.otm, reboot my machine, and recreate the macro. After doing that helloworld.vbs works... it works until I close Outlook again.

My google-fu has failed me (the only solutions I've found for this issue are "delete the project file and recreate the macro").

Anyone know why I have this problem and how to permamently fix it?


This is in Outlook 2000 running on Win2k SP4

Sukotto
05-25-2007, 06:27 AM
In the end I just gave up. :-(
Instead, I pushed all my code out to the vbscript file.