Outlook

mcompo

New member
Local time
Today, 20:33
Joined
Nov 13, 2008
Messages
1
I have created a button on the toolbar in outlook which when click runs some code to change the subject line on the email to say that I am dealing with the request.

I would like to also add on the macro to automatically transfer the email to a specified folder called 'completed requests'

Therefore when the button is clicked it will change the subject field to say 'name dealing with this request' then automatically move the email to a folder called 'completed requests'

Can this be done.

This is my code below

Sub ClosedByMe()
On Error Resume Next
Dim strMessage As String
strMessage = "Closed by Marc " & Now() & " - "
Set msg = Application.ActiveInspector.CurrentItem
msg.Subject = strMessage & msg.Subject
End Sub
 
Not an Outlook VBA expert, but, I dont believe you can alter the subject line of received mail directly.

But....

What you could do is

1) get VBA to set up a reply. You can change the subject in the newly created mail.
Code:
    Dim rpl As Outlook.MailItem
    dim newmsg as Outlokk.MailItem
    Dim itm As Object
    
    Set itm = GetCurrentItem()
    If Not itm Is Nothing Then
        Set rpl = itm.Reply
        rpl.message = "new message"     
    End If

2) Move the draft to your target folder

Code:
set NewMsg = rpl.Move(SomeFolder)

or something like that. Just bashed this code so it may not work, but hopefully points you in the right direction.
 

Users who are viewing this thread

Back
Top Bottom