Solved

need line to add to script in outlook

Posted on 2010-11-26
13
246 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
  • 5
  • 5
  • 3
13 Comments
 
LVL 13

Expert Comment

by:gbanik
Comment Utility
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
Comment Utility
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
Comment Utility
chris it gives me an error at the . in the email address and says compile error expected end of sub
0
 
LVL 13

Expert Comment

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

Author Comment

by:Bigbill93638
Comment Utility
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
Comment Utility
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 13

Expert Comment

by:gbanik
Comment Utility
@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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
That worked, thanks!
0
 
LVL 59

Expert Comment

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

Chris
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Email signatures have numerous marketing benefits. Here are 8 top reasons to turn your email signature into a marketing channel.
Check out this infographic on what you need to make a good email signature that will work perfectly for your organization.
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
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: …

772 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

14 Experts available now in Live!

Get 1:1 Help Now