I found a nice script on slipstick website by Diane. Unfortunately I cannot get them to run. I am a bit new at VBA. I want to use the script Reply to a web form generated message. I already have some macros that work. In ThisOutlookSession I have pasted the code above below the other macros. The name SendNew shows up in the right corner where the name of the macros are displayed. But when I save, it doesn't show up when I hit Alt-F8. When I remove Item As Outlook.MailItem from between the brackets, the name SendItem does show up when I hit Alt-F8, but there is an error 424 in the script now. So a bit of a catch 22. I would love some advice on how to solve this. I have googled quite a bit...
This same issue, that a name of a script that I download from the internet shows up in the right top corner, but when I save, it doesn't show up when I hit Alt-F8, happens frequently, so there is something basic there that I don't understand.
The script from Diane:
Sub SendNew(Item As Outlook.MailItem)
Dim Reg1 As Object
Dim M1 As Object
Dim M As Object
Dim strAddress As String
Set Reg1 = CreateObject("VBScript.RegExp")
With Reg1
.Pattern = "(([\w-\.]*\@[\w-\.]*)\s*)"
.IgnoreCase = True
.Global = False
End With
If Reg1.Test(Item.Body) Then
Set M1 = Reg1.Execute(Item.Body)
For Each M In M1
strAddress = M.SubMatches(1)
Next
End If
Dim objMsg As MailItem
Set objMsg = Application.CreateItemFromTemplate("C:\path\to\template.oft")
objMsg.Recipients.Add strAddress
' Copy the original message subject
objMsg.Subject = "Thanks: " & Item.Subject
' use for testing
objMsg.display
' objMsg.Send
End Sub
This same issue, that a name of a script that I download from the internet shows up in the right top corner, but when I save, it doesn't show up when I hit Alt-F8, happens frequently, so there is something basic there that I don't understand.
The script from Diane:
Sub SendNew(Item As Outlook.MailItem)
Dim Reg1 As Object
Dim M1 As Object
Dim M As Object
Dim strAddress As String
Set Reg1 = CreateObject("VBScript.RegExp")
With Reg1
.Pattern = "(([\w-\.]*\@[\w-\.]*)\s*)"
.IgnoreCase = True
.Global = False
End With
If Reg1.Test(Item.Body) Then
Set M1 = Reg1.Execute(Item.Body)
For Each M In M1
strAddress = M.SubMatches(1)
Next
End If
Dim objMsg As MailItem
Set objMsg = Application.CreateItemFromTemplate("C:\path\to\template.oft")
objMsg.Recipients.Add strAddress
' Copy the original message subject
objMsg.Subject = "Thanks: " & Item.Subject
' use for testing
objMsg.display
' objMsg.Send
End Sub