Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-30-2017, 01:50 AM
ozgurpeh ozgurpeh is offline Forwarding E-mail with using macro Windows 10 Forwarding E-mail with using macro Office 2016 for Mac
Novice
Forwarding E-mail with using macro
 
Join Date: Jun 2017
Posts: 3
ozgurpeh is on a distinguished road
Default Forwarding E-mail with using macro

Hi Everyone,



How can I automaticallly forward a certainincoming subject e-mail with using VBA?
And to Subject area, I want to write a subject,

I'm waiting for your help,
Thanks
Reply With Quote
  #2  
Old 06-30-2017, 03:41 AM
gmayor's Avatar
gmayor gmayor is offline Forwarding E-mail with using macro Windows 10 Forwarding E-mail with using macro Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,105
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

That's fairly simple using a rule to identify the incoming message and a script to create the forwarded mail e.g.

Code:
Option Explicit

Sub MyFwd(olItem As MailItem)
Dim olFWD As MailItem
Dim olInsp As Outlook.Inspector
Dim wdDoc As Object
Dim oRng As Object
    Set olFWD = olItem.Forward
    With olFWD
        .Display
        .Subject = "The new subject"
        .To = "someone@somewhere.com"
        Set olInsp = .GetInspector
        Set wdDoc = olInsp.WordEditor
        Set oRng = wdDoc.Range(0, 0)
        oRng.Text = "Please see the correspondence below."
        .Send
    End With
    olItem.UnRead = False
lbl_Exit:
    Set olFWD = Nothing
    Set olInsp = Nothing
    Set wdDoc = Nothing
    Set oRng = Nothing
    Exit Sub
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #3  
Old 06-30-2017, 04:21 AM
ozgurpeh ozgurpeh is offline Forwarding E-mail with using macro Windows 10 Forwarding E-mail with using macro Office 2016 for Mac
Novice
Forwarding E-mail with using macro
 
Join Date: Jun 2017
Posts: 3
ozgurpeh is on a distinguished road
Default

Quote:
Originally Posted by gmayor View Post
That's fairly simple using a rule to identify the incoming message and a script to create the forwarded mail e.g.

Code:
Option Explicit

Sub MyFwd(olItem As MailItem)
Dim olFWD As MailItem
Dim olInsp As Outlook.Inspector
Dim wdDoc As Object
Dim oRng As Object
    Set olFWD = olItem.Forward
    With olFWD
        .Display
        .Subject = "The new subject"
        .To = "someone@somewhere.com"
        Set olInsp = .GetInspector
        Set wdDoc = olInsp.WordEditor
        Set oRng = wdDoc.Range(0, 0)
        oRng.Text = "Please see the correspondence below."
        .Send
    End With
    olItem.UnRead = False
lbl_Exit:
    Set olFWD = Nothing
    Set olInsp = Nothing
    Set wdDoc = Nothing
    Set oRng = Nothing
    Exit Sub
End Sub
Thank you for your support,
But I only forward the certain subjects=tests,
The subjects which are contins tests, Thats why I only want to forward that subject and specific e-mail adress.
Reply With Quote
  #4  
Old 06-30-2017, 05:07 AM
gmayor's Avatar
gmayor gmayor is offline Forwarding E-mail with using macro Windows 10 Forwarding E-mail with using macro Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,105
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

You can choose which messages to respond to through the rules settings (though I have just spotted that you are using the Mac version which I don't know about). You'll have to test whether the macro works on the Mac - sorry
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #5  
Old 06-30-2017, 05:16 AM
ozgurpeh ozgurpeh is offline Forwarding E-mail with using macro Windows 10 Forwarding E-mail with using macro Office 2016 for Mac
Novice
Forwarding E-mail with using macro
 
Join Date: Jun 2017
Posts: 3
ozgurpeh is on a distinguished road
Default

Quote:
Originally Posted by gmayor View Post
You can choose which messages to respond to through the rules settings (though I have just spotted that you are using the Mac version which I don't know about). You'll have to test whether the macro works on the Mac - sorry
I didn't do anything like that in excell macro, I don't know, how to make in Outllook, Could you please show me how to do it. And by the way I'm using Win10.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Forwarding E-mail with using macro Mail Merge Macro ch1325 Word VBA 2 06-08-2015 06:18 AM
Mail Merge Macro spc94 Word VBA 2 06-04-2015 07:06 AM
Forwarding E-mail with using macro Send e-mail by macro plamenbv Excel Programming 1 04-16-2012 05:25 AM
E-mail deleted after replying or forwarding carolina Outlook 0 03-28-2012 03:29 PM
Macro for sending mail and opening the sent mail afterwards Rumlegok Outlook 0 09-20-2011 07:27 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:40 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft