![]() |
#1
|
|||
|
|||
![]()
Hi Guys,
I am a noob with outlook macro and been toiling around the internet helplessly for some assistance on a macro. I am looking for a macro in outlook 2010, which will get trigger whenever an email is being reply by a user with a shared mailbox. The macro will perform the below steps 1.“Lock” the email so that other users is not able to reply to the email 2.Scan subject header for a unique reference in the format of CASEDDMMMYYHHMMSSXXX ·Where “CASE” is fixed ·“DDMMMYY” follow the date format - DD and YY in number and MMM in aphabet ·“HHMMSS” follow the 24 hour time format ·“XXX” denote the number of character on the original subject header 3.If this reference is available, no changes is required. Original email will be moved to a preset folder after email is sent 4.If this reference is not available, append the unique reference at the end of the subject header*. Original email with new subject header will be moved to a preset folder after email is sent *for example, if the original email subject is “URGENT – Need your Response ASAP”, the macro will change the subject header to “URGENT – Need your Response ASAP – CS01FEB13223763032” Appreciate any help i can get! ![]() ![]() |
#2
|
||||
|
||||
![]()
Hi rainpuppy,
AFAIK it is not possible to change the subject header of a received email. The most you could do is append your extra info to a reply. Testing for the string before appending to a reply is fairly straightforward, though, with an IF test like: Code:
If Not .Subject Like "*CASE##???###########" Then .Subject = .Subject & " - CASE" & Format(Now, "DDMMMYYhhmmss") & Format(Len(.Subject), "000") End If
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
![]() Quote:
Thanks for your help. How can i trigger this piece of code whenever I reply to a email? |
#4
|
|||
|
|||
![]()
Hi,
Thanks for the help above. How can i auto trigger the code whenever i reply to a email? |
#5
|
||||
|
||||
![]()
You probably wouldn't want to do this to every email, but only to selected emails.
As I said in my previous post, I don't use Outlook (and don't really have time to learn it's intricacies), so the following is based on code from: http://www.vboffice.net/sample.html?...9&cmd=showitem Code:
Public Sub ReplyMail() Dim obj As Object Dim oReply As Outlook.MailItem Select Case True Case TypeOf Application.ActiveWindow Is Outlook.Inspector Set obj = Application.ActiveInspector.CurrentItem Case Else With Application.ActiveExplorer.Selection If .Count Then Set obj = .Item(1) End With If obj Is Nothing Then Exit Sub End Select If TypeOf obj Is Outlook.MailItem Then Set oReply = obj.Reply With oReply If Not .Subject Like "*CASE##???###########" Then .Subject = .Subject & " - CASE" & Format(Now, "DDMMMYYhhmmss") & Format((Len(.Subject) Mod 1000), "000") End If .Display End With End If End Sub If you're interested in Outlook programming, see: http://msdn.microsoft.com/en-us/libr...gInOutlook2010. In addition to it's own examples, that page has a number of useful links, one of which took me to the link mentioned earlier in this post.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Macro help outlook 2010 | seanchad | Outlook | 0 | 06-28-2012 02:49 AM |
![]() |
jomarie | Office | 1 | 02-19-2012 07:45 PM |
Mail with macro Excel 2010 | santors71 | Excel Programming | 1 | 12-07-2011 06:34 AM |
Macro - Microsoft Word 2010 | OfficeHelpSG | Word | 3 | 10-18-2011 11:54 AM |
![]() |
Joyce301 | Word VBA | 3 | 04-29-2011 03:27 PM |