Solved

need line to add to script in outlook

Posted on 2010-11-26
13
250 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

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.

Question has a verified solution.

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

This article lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

735 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