Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-01-2013, 06:05 AM
rainpuppy rainpuppy is offline Need help on Outlook 2010 Macro Windows 7 32bit Need help on Outlook 2010 Macro Office 2010 32bit
Novice
Need help on Outlook 2010 Macro
 
Join Date: Feb 2013
Posts: 3
rainpuppy is on a distinguished road
Smile Need help on Outlook 2010 Macro

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!
Reply With Quote
  #2  
Old 02-01-2013, 10:44 PM
macropod's Avatar
macropod macropod is offline Need help on Outlook 2010 Macro Windows 7 64bit Need help on Outlook 2010 Macro Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,340
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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
As for working with shared folders, see: http://support.microsoft.com/?kbid=208520. As I don't use Outlook, I can't really advise as to how you'd lock others out from responding.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 02-03-2013, 06:21 AM
rainpuppy rainpuppy is offline Need help on Outlook 2010 Macro Windows 7 32bit Need help on Outlook 2010 Macro Office 2010 32bit
Novice
Need help on Outlook 2010 Macro
 
Join Date: Feb 2013
Posts: 3
rainpuppy is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
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
As for working with shared folders, see: http://support.microsoft.com/?kbid=208520. As I don't use Outlook, I can't really advise as to how you'd lock others out from responding.
Hi,

Thanks for your help. How can i trigger this piece of code whenever I reply to a email?
Reply With Quote
  #4  
Old 02-03-2013, 06:29 AM
rainpuppy rainpuppy is offline Need help on Outlook 2010 Macro Windows 7 32bit Need help on Outlook 2010 Macro Office 2010 32bit
Novice
Need help on Outlook 2010 Macro
 
Join Date: Feb 2013
Posts: 3
rainpuppy is on a distinguished road
Default

Hi,

Thanks for the help above. How can i auto trigger the code whenever i reply to a email?
Reply With Quote
  #5  
Old 02-04-2013, 12:44 AM
macropod's Avatar
macropod macropod is offline Need help on Outlook 2010 Macro Windows 7 64bit Need help on Outlook 2010 Macro Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,340
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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 assign the above to a keyboard shortcut, I believe it will initialize a reply with the required additional header text, where appropriate, whenever an email is selected and the keyboard shortcut is invoked.

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]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro help outlook 2010 seanchad Outlook 0 06-28-2012 02:49 AM
Need help on Outlook 2010 Macro Word 2010 Macro 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
Need help on Outlook 2010 Macro Run a Macro in Word 2010 Joyce301 Word VBA 3 04-29-2011 03:27 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 08:29 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft