Solved

need line to add to script in outlook

Posted on 2010-11-26
13
251 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
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 
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

Create Professional Looking Email Signatures

Create "Professional HTML Email Signatures" with ease.
7 Day Money Back Guarantee if not 100% Satisfied.
Affordable - Try it out for 7 Days Totally Risk Free.
Installers provided for over 45 Email clients.
Both Windows & MAC Supported.
Highly Recommended!

Question has a verified solution.

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

What does UTC stand for?  “Coordinated Universal Time” – Think of this as the true time on Planet Earth that never changes with the exception of minor leap seconds here and there to account for the changes in the planet's rotation.   What does th…
How to resolve IMCEAEX NDRs in Exchange or Exchange Online related to invalid X500 addresses.
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

738 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