Helpspot forward – VBA version

Here’s a macro that forwards all messages that you put in a particular folder into helpspot. If you’re interested in this sort of thing, let me know. Obviously, you could make it so that dragging stuff into any folder auto-forwards to someone else. The sky’s the limit! 🙂

There’s a subsidiary issue wrt code signing which I would be glad to discuss if there’s interest.

' Taken from http://tinyurl.com/yb6xtag
' Copyright under GPL by Mark Grimes
' Edited by Joshua McNary (with help from Vaish Pidathala) for use with Toodledo.com
' Changed by Ben Chapman for use with HelpSpot 2/2010
' This requires you to set a folder under your inbox in Exchange called "TO_HELPSPOT"
' Change as required.
' Change email address from HELPSPOTEMAIL@YOURDOMAIN.EDU to your helpspot email.

' Most importantly, you'll need to develop some solution to the Outlook macro security settings issue
' in Office 2007. The settings are very restrictive.

Option Explicit

Private WithEvents objActionItems As Items

' instantiate Items collections for folders we want to monitor
Private Sub Application_Startup()
Dim objNS As NameSpace
Set objNS = Application.GetNamespace("MAPI")
' CHANGEME as required
Set objActionItems = objNS.GetDefaultFolder(olFolderInbox).Folders.Item("to_helpspot").Items
Set objNS = Nothing
End Sub

' disassociate global objects declared WithEvents
Private Sub Application_Quit()
Set objActionItems = Nothing
End Sub

' Forward msg when new msg added to folder
' Prompt before sending
Private Sub objActionItems_ItemAdd(ByVal Item As Object)
Dim Response As Variant
Dim myForward As Variant

Response = MsgBox("Forward message (" + Item.Subject + ") to HelpSpot?", vbYesNo)
If Response = vbYes Then
Set myForward = Item.Forward
myForward.Subject = "" + Item.Subject + " ##forward:true##"
' CHANGEME as require
myForward.Recipients.Add "HELPSPOTEMAIL@YOURDOMAIN.EDU"
myForward.Send
End If
End Sub
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s