Results 1 to 5 of 5
  1. #1
    Lounger
    Join Date
    Nov 2003
    Location
    Scarsdale, New York, USA
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Outlook 2010 VBA Code to Forward Email

    Looking for assistance in either fixing code or streamlining it.

    The code below has been working for well over a year on at least two Windows 7 computers. Computer A had Outlook 2007 and Computer B had Outlook 2010. After Computer A was upgraded to Outlook 2010, the code below stopped working.

    The only object of this code is to forward the selected email to a specific email address and append the subject:

    Code:
    Sub Complete()
    
    ' Send Completed Message to support
    
    On Error Resume Next
    
    Dim oApp As Outlook.Application
    Dim objFolder As Outlook.MAPIFolder
    Set oApp = New Outlook.Application
    Set objNS = Application.GetNamespace("MAPI")
    Set objInbox = objNS.GetDefaultFolder(olFolderInbox)
    Set objFolder = objInbox.Folders("Helpdesk")
    Dim oEmail As Outlook.MailItem
    
    'Require that this procedure be called only when a message is selected
    If Application.ActiveExplorer.Selection.Count = 0 Then
        Exit Sub
    End If
    
    For Each objItem In Application.ActiveExplorer.Selection
        If objFolder.DefaultItemType = olMailItem Then
            If objItem.Class = olMail Then
                Response = MsgBox("Forward message (" + Item.Subject + ") to Appended Subject")
                Set myForward = objItem.Forward
                myForward.Subject = "APPENDED SUBJECT - " + objItem.Subject + ""
                myForward.Recipients.Add "John Doe <jdoe@someaddress.com>"
                myForward.Send
            End If
        End If
    Next
    
    End Sub

  2. #2
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,434
    Thanks
    372
    Thanked 1,457 Times in 1,326 Posts
    egoche,

    You say it stopped working? Exactly what error messages do you get if any? Have you remembered to change your Trust Center settings after the upgrade?
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  3. #3
    Lounger
    Join Date
    Nov 2003
    Location
    Scarsdale, New York, USA
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The Trust Center setting is one of the first things I thought of and that definitely needed to be relaxed a bit but the code still doesn't work.

    The code is associated with a custom button on the ribbon, but pressing the button results in nothing...no error message, etc. It's as if the button has no coding associated with it.

  4. #4
    Lounger
    Join Date
    Nov 2003
    Location
    Scarsdale, New York, USA
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Problem was resolved; the Module was apparently corrupt. After deleting and recreating it, the coding is working fine now.

  5. #5
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,434
    Thanks
    372
    Thanked 1,457 Times in 1,326 Posts
    egoche,

    Glad you got it sorted!
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •