Solved

need line to add to script in outlook

Posted on 2010-11-26
13
253 Views
Last Modified: 2012-05-10
Need line of script to forward email to bigbill99.3fc@m.evernote.com for outlook 2010
0
Comment
Question by:Bigbill93638
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
  • 3
13 Comments
 
LVL 13

Expert Comment

by:gbanik
ID: 34222681
Here's your code...
Option Explicit
Private Const sForwardAddr As String = "bigbill99.3fc@m.evernote.com"

Public Sub ForwardAllSelectedMails()
   On Error Resume Next
    Dim objItem As Outlook.MailItem

    If Application.ActiveExplorer.Selection.Count = 0 Then
        Exit Sub
    End If

    For Each objItem In Application.ActiveExplorer.Selection
        If objItem.Class = olMail Then
            Set objItem = objItem.Forward
            objItem.To = sForwardAddr
            objItem.Send
        End If
    Next
    
End Sub

Open in new window

0
 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 34223621
Adapting from the earlier rule then how about:

Note if the subject is to be unchanged on the forward then delete the first two lines and enable the last two

Chris
Sub Q26638986(Item As MailItem)
dim mai as object

    Item.Subject = Item.Subject & " @quotes #quotes"
    Item.Save

    Set mai = objItem.Forward
    mai.To = bigbill99.3fc@m.evernote.com
    mai.Send

'    Item.Subject = Item.Subject & " @quotes #quotes"
'    Item.Save

 
End Sub

Open in new window

0
 

Author Comment

by:Bigbill93638
ID: 34223655
chris it gives me an error at the . in the email address and says compile error expected end of sub
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
LVL 13

Expert Comment

by:gbanik
ID: 34223817
@Bigbill93638, did the code piece I suggested work for you?
0
 

Author Comment

by:Bigbill93638
ID: 34224176
no, the first part works, then it doesn't forward. as below

Sub Q26638986(Item As MailItem)
    Item.Subject = Item.Subject & " @quotes #quotes"
    Item.Save
Option Explicit
Private Const sForwardAddr As String = "bigbill99.3fc@m.evernote.com"

Public Sub ForwardAllSelectedMails()
   On Error Resume Next
    Dim objItem As Outlook.MailItem

    If Application.ActiveExplorer.Selection.Count = 0 Then
        Exit Sub
    End If

    For Each objItem In Application.ActiveExplorer.Selection
        If objItem.Class = olMail Then
            Set objItem = objItem.Forward
            objItem.To = sForwardAddr
            objItem.Send
        End If
    Next
   
End Sub
0
 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 34224371
OOps missed a bit


Can't test currently as I haven't installed office in the Windows partition and cant enable macros in the Mac version .... still, note to self must request attention on my Q!.

Chris
ub Q26638986(Item As MailItem)
dim mai as object

    Item.Subject = Item.Subject & " @quotes #quotes"
    Item.Save

    Set mai = objItem.Forward
    mai.To = "bigbill99.3fc@m.evernote.com"
    mai.Send

'    Item.Subject = Item.Subject & " @quotes #quotes"
'    Item.Save

 
End Sub

Open in new window

0
 
LVL 13

Expert Comment

by:gbanik
ID: 34225506
@Bigbill93638, thats not the code I posted. Can you please check my code (posted again below)? I have rechecked and it seems this may be what u want.
Option Explicit
Private Const sForwardAddr As String = "bigbill99.3fc@m.evernote.com"

Public Sub ForwardAllSelectedMails()
   On Error Resume Next
    Dim objItem As Outlook.MailItem

    If Application.ActiveExplorer.Selection.Count = 0 Then
        Exit Sub
    End If

    For Each objItem In Application.ActiveExplorer.Selection
        If objItem.Class = olMail Then
            Set objItem = objItem.Forward
            objItem.To = sForwardAddr
            objItem.Send
        End If
    Next
    
End Sub

Open in new window

0
 

Author Comment

by:Bigbill93638
ID: 34225952
qbanik, I need to add what you did to what I have in order for it to work, the first part codes it for evernote the second part (what you are doing) sends it. Can you make that work?
0
 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 34225965
Nothing from my post?

Chris
Sub Q26638986(Item As MailItem)
dim mai as object

    Item.Subject = Item.Subject & " @quotes #quotes"
    Item.Save

    Set mai = objItem.Forward
    mai.To = "bigbill99.3fc@m.evernote.com"
    mai.Send

'    Item.Subject = Item.Subject & " @quotes #quotes"
'    Item.Save

 
End Sub

Open in new window

0
 

Author Comment

by:Bigbill93638
ID: 34226014
Chris, no it doesn't give me the error but it doesn't forward either.
0
 
LVL 59

Accepted Solution

by:
Chris Bottomley earned 500 total points
ID: 34226215
Ah

HAd to make another mod to work with the old code ... as said before lack of working outlook install is  pain!

Chris
ub Q26638986(Item As MailItem)
dim mai as object

    Item.Subject = Item.Subject & " @quotes #quotes"
    Item.Save

    Set mai = Item.Forward
    mai.To = "bigbill99.3fc@m.evernote.com"
    mai.Send

'    Item.Subject = Item.Subject & " @quotes #quotes"
'    Item.Save

 
End Sub

Open in new window

0
 

Author Comment

by:Bigbill93638
ID: 34226281
That worked, thanks!
0
 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 34226313
Sorry about the error, the problem with cut and paste from an object file copy.

Chris
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Outlook for dependable use in a very small business   This article is about using the Outlook application (part of Microsoft Office) in a very small business, or for homeowners where dependability and reliability are critical requirements. This …
This article describes how to import Lotus Notes Contacts into Outlook 2016, 2013, 2010 and 2007 etc. with a few manual steps. You can easily export and migrate Lotus Notes contacts into Microsoft Outlook without having to use any third party tools.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

617 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