Hello,
I'm looking to have some VBA code to auto-insert the current date every time I click new email.
I was able to figure out the code to run as a Macro of how I want it to work (adapted from your code )but can't figure out how to automate it. Help Please
Sub AddDatetoSubject()
Dim myolApp As Outlook.Application
Dim aItem As MailItem ' Object
Set myolApp = CreateObject("Outlook.Application")
Set mail = myolApp.ActiveExplorer.CurrentFolder
Dim iItemsUpdated As Integer
Dim strTemp As String
Dim strDate As String
iItemsUpdated = 0
For Each aItem In mail.Items
Debug.Print aItem.ConversationTopic
strDate = Format(aItem.ReceivedTime, "yy-mm-dd")
strTemp = strDate & " " & aItem.Subject
aItem.Subject = strTemp
iItemsUpdated = iItemsUpdated + 1
aItem.Save
Next aItem
MsgBox iItemsUpdated & " of " & mail.Items.Count & " Messages Updated"
Set myolApp = Nothing
End Sub
I'm looking to have some VBA code to auto-insert the current date every time I click new email.
I was able to figure out the code to run as a Macro of how I want it to work (adapted from your code )but can't figure out how to automate it. Help Please
Sub AddDatetoSubject()
Dim myolApp As Outlook.Application
Dim aItem As MailItem ' Object
Set myolApp = CreateObject("Outlook.Application")
Set mail = myolApp.ActiveExplorer.CurrentFolder
Dim iItemsUpdated As Integer
Dim strTemp As String
Dim strDate As String
iItemsUpdated = 0
For Each aItem In mail.Items
Debug.Print aItem.ConversationTopic
strDate = Format(aItem.ReceivedTime, "yy-mm-dd")
strTemp = strDate & " " & aItem.Subject
aItem.Subject = strTemp
iItemsUpdated = iItemsUpdated + 1
aItem.Save
Next aItem
MsgBox iItemsUpdated & " of " & mail.Items.Count & " Messages Updated"
Set myolApp = Nothing
End Sub