Bigbill93638
asked on
need line to add to script in outlook
Need line of script to forward email to bigbill99.3fc@m.evernote.c om for outlook 2010
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
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
ASKER
chris it gives me an error at the . in the email address and says compile error expected end of sub
@Bigbill93638, did the code piece I suggested work for you?
ASKER
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
Sub Q26638986(Item As MailItem)
Item.Subject = Item.Subject & " @quotes #quotes"
Item.Save
Option Explicit
Private Const sForwardAddr As String = "bigbill99.3fc@m.evernote.
Public Sub ForwardAllSelectedMails()
On Error Resume Next
Dim objItem As Outlook.MailItem
If Application.ActiveExplorer
Exit Sub
End If
For Each objItem In Application.ActiveExplorer
If objItem.Class = olMail Then
Set objItem = objItem.Forward
objItem.To = sForwardAddr
objItem.Send
End If
Next
End Sub
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
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
@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
ASKER
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?
Nothing from my post?
Chris
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
ASKER
Chris, no it doesn't give me the error but it doesn't forward either.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That worked, thanks!
Sorry about the error, the problem with cut and paste from an object file copy.
Chris
Chris
Open in new window