# Marco doesn't show up when using Alt-F8

Status
Not open for further replies.

#### Michiel

New Member
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

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
Next
End If

Dim objMsg As MailItem
Set objMsg = Application.CreateItemFromTemplate("C:\path\to\template.oft")

' Copy the original message subject
objMsg.Subject = "Thanks: " & Item.Subject

' use for testing
objMsg.display

' objMsg.Send

End Sub

#### Diane Poremsky

Senior Member
This part: Sub SendNew(Item As Outlook.MailItem) means it needs to be called by another macro (or a run a script rule). If you remove the mailitem part, you need to set the item in the macro.

This should work to call the macro for the selected item. If you want it to work with open or selected items, get the function from Outlook VBA: Work with Open Item or Selected Item and use
Set Item = GetCurrentItem()

if you want to use 1 macro, you need to add the dim and set to the original macro (and remove the item as mailitem part)

Code:
sub runmacro()
Dim Item As Outlook.MailItem

Set Item = Application.ActiveExplorer.Selection.Item(1)

SendNew Item
end sub

#### Michiel

New Member
Hi Diane,
The first part of your explanation I didn't quite follow, but the last part worked for me. I pasted your code below the original code, deleted the text between the brackets and works like a charm. Thank you!

Status
Not open for further replies.
Thread starter Title Forum Replies Date
Marco in search of text in subject line Using Outlook 8
Why doesn't outlook use "Normal" style for new messages? Using Outlook 3
outlook 2007 doesn't let me choose which .pst to search Using Outlook 2
Follow up button doesn't working neither the reminders in BCM BCM (Business Contact Manager) 0
Sender's Name Doesn't Appear in the From Field on Outlook 365/IMAP Using Outlook 2
VBScript doesn't run on Recipient Email Outlook VBA and Custom Forms 2
Outlook Mobile App Doesn't Refresh Inbox Using Outlook 0
Outlook 365 doesn't always mark emails as read Using Outlook 3
Simple calendar sharing doesn't work Using Outlook 6
Calendar View in Outlook Office 365 - Doesn't show enough hours, and the 30/60 min choice isn't the solution Using Outlook 4
Desktop doesn't index Outlook IMAP files, laptop Outlook does index those same IMAP files Using Outlook 2
Outlook rule run a Script doesn't work Outlook VBA and Custom Forms 1
Accessing shared outlook folder doesn't work since switch to new outlook/excel Outlook VBA and Custom Forms 11
VB script in outlook form doesn't work anymore Outlook VBA and Custom Forms 2
Junk mail doesn't work Using Outlook 3
Custom form code doesn't run Outlook VBA and Custom Forms 2
New email setup dialog doesn't allow alias Using Outlook 2
Item edits doesn't always sync Using Outlook 11
scanpst.exe doesn't repair .pst file Using Outlook 1
"From" field doesn't show extra email addresses in Outlook 2016. Using Outlook.com accounts in Outlook 6
Worksheet doesn't show on jumplist Using Outlook 1
Outlook 2016 doesn't show contacts in address book Using Outlook 2
Run script doesn't work in outlook Using Outlook 1
Category Color doesn't Display in Inbox New Slipstick.com Articles 0
Run a Script Rule doesn't work Using Outlook 5
AutoForward Randomly Doesn't fwd emails Using Outlook 3
Receive a Reminder When a Message Doesn't Arrive? New Slipstick.com Articles 10
Macro doesn't recognize local mails from colleagues Outlook VBA and Custom Forms 2
Filter condition "contains"/"doesn't contain" doesn't always work Using Outlook 10
Outlook hidden even when open (maximising doesn't fix it) Using Outlook 2
outlook 2007 - opening a contact from the search results doesn't use the custom form Using Outlook 10
yahoo mail doesn't send or receive reliably Using Outlook 1
VBA to modify appointment item in additional Exchange account doesn't work Using Outlook 0
Outlook2013 - "From" name doesn't change even when changed in Account Setting Using Outlook 4
doesn't show up previous info (email, contacts and tasks)after windows up date Using Outlook 0
Change folder doesn't work Using Outlook 2
run-time 438: object doesn't support this property or method Using Outlook 2
MAC outlook doesn't show the meeting organizer detail Using Outlook 0
Newly added user doesn't show up in GAL but available in OWA, Using Outlook 0
Archiving of emails doesn't work anymore Using Outlook 3
outlook rule doesn't run automatically Using Outlook 0
Clicking box to delete junk mail doesn't stay Using Outlook 2
Outlook 2013 Doesn't Send email from Web Page Unless Outlook Is Open Using Outlook 2
Calculating the age of an Outlook contact doesn't work Using Outlook 20
Recipient email address doesn't get underlined Using Outlook 4
Published Email Form Doesn't Display Text Boxes to the Recipient Using Outlook 0
Send/Receive All Folders doesn't show Progress status Using Outlook 14