I am attempting to set up my Outlook 2007 client to run a rule against
messages with a specific subject that will in turn run a macro to export the
body to a local file that will be used for input by Powershell. Here is a
copy of the macro I pulled from the web.
' (C) Dmitry Sotnikov
' Add this to your Outlook macros project
' Then associate SaveAsText with a rule procesing
' emails from your address with a keyword in subject
' This is to have a Sleep function in Outlook
Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
' The main function saving the script email as
' and sending back the transcript
Sub SaveAsText(MyMail As MailItem)
' Export email (with PowerShell script in body) as a text file
MyMail.SaveAs "c:scriptsoutlook.ps1", olTXT
' Create a response email
Dim reMail As Outlook.MailItem
Set reMail = MyMail.Reply
' wait till transcript is available
Set fs = CreateObject("Scripting.FileSystemObject")
While Not fs.FileExists("C:Scriptsemail_transcript.txt")
' attach the transcript and send it back
When this added in the VBA Editor. I can not see this when I attempt to run
a macro. If I create a new test macro with out an argument defined with sub.
I can see it fine and run the macro all day.
MsgBox ("Hello World")
To make this worse. I have no VBA experience so troubleshooting this has
been very difficult.
When you reply please keep it simple and feel free to talk down to me.... :-)