I have this Macro which I am trying to call from the outlook Ribbon. The macro basically needs to run whenever I click it so it can reply to the message I select.
(I went through the right click ->customize->Macros-> and created this macro shortcut (replywithHTML) onto a new menu toolbar on the ribbon.
however I keep getting a "Project1.RepllywithHTMl macro cannot be found". However when I go into the VB editor the code works.
What seems to be the issue here?
here is the macro in a module in outlook 2007
Public Sub ReplyWithHtml()
Dim oMail As Outlook.MailItem
Dim oFSO
Dim oFS
If Application.ActiveExplorer.Selection.Count Then
If TypeOf Application.ActiveExplorer.Selection(1) Is Outlook.MailItem Then
Set oMail = Application.ActiveExplorer.Selection(1).ReplyAll
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oFS = oFSO.OpenTextFile("C:\Quarantine.htm")
stext = oFS.ReadAll
oMail.BodyFormat = olFormatHTML
oMail.HTMLBody = stext & vbCr & oMail.HTMLBody
oMail.Display
End If
End If
End Sub
Bookmarks