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.
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