Outlook VBA Programming - Forward Selected Email To Set Address

Posted on 2006-04-18
Last Modified: 2010-04-17

I am trying to create a VBA macro to forward a selected email to a set email address e.g. "".

I have already got this script -
"Set myOlApp = CreateObject("Outlook.Application")
Set myNameSpace = myOlApp.GetNamespace("MAPI")
Set myfolder = myNameSpace.GetDefaultFolder(olFolderInbox)
Set myForward = myfolder.Items(4).Forward
myForward.Recipients.Add ""

The problem with the code above is that you have to pre-define the email item before you run the macro. I want to be able to select the email item instead of pre-defining it.

We are currently using Outlook 2000.

Any ideas?


david jacques

Question by:cmrecruitment
    LVL 1

    Expert Comment

    Hi , what do you mean exactly by email item?
    why dont you add an InputBox() to be asked for the emai iteml each time you use the function

    Author Comment


    I mean the email currently selected within outlook.

    Basically I would like to select an email within my outlook and then click a macro which forwards the email off to a set email address e.g. ""

    david jacques
    LVL 1

    Accepted Solution

    Hi , I have written this sub and it works,  you just select the email that you would like to send, regardless whether in the inbox or elsewehre, enjoy !

    Sub explorerNames()
    Dim myOlApp As New Outlook.Application
        Dim myOlExp As Outlook.Explorer
        Dim myOlSel As Outlook.Selection
        Dim MsgTxt As String
        Dim x As Integer
        Dim myNms As Outlook.NameSpace
        Dim myFolder As Outlook.MAPIFolder
        Dim myRecipient As Outlook.Recipient
        Dim myItem As MailItem
        MsgTxt = "You have selected items from: "
        Set myOlExp = myOlApp.ActiveExplorer
        Set myOlSel = myOlExp.Selection
        Set myItem = myOlSel.Item(1)
        For x = 1 To myOlSel.Count
                  MsgTxt = myItem.SenderName
            Set myforward = myItem.Forward
            myforward.To = ""
        Next x

    End Sub

    Author Comment

    Thanks for the help.

    This is really going to help us out.

    Enjoy the points.

    thanks david jacques

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Join & Write a Comment

    Purpose To explain how to place a textual stamp on a PDF document.  This is commonly referred to as an annotation, or possibly a watermark, but a watermark is generally different in that it is somewhat translucent.  Watermark’s may be text or graph…
    RIA (Rich Internet Application) tools are interactive internet applications which have many of the characteristics of desktop applications. The RIA tools typically deliver output either by the way of a site-specific browser or via browser plug-in. T…
    In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    26 Experts available now in Live!

    Get 1:1 Help Now