Thread: Macros
View Single Post
 
Old 06-01-2011, 04:39 PM
nore nore is offline Windows 7 32bit Office 2003
Novice
 
Join Date: Jun 2011
Posts: 1
nore is on a distinguished road
Default Macros

Greetings

So I am creating a new email message and I want to append a certain string to the subject (eg. date in ddmmyyyyhhmm format). How can that be done?

I'm trying that in VB (unless there is another way), but I couldn't find a method to get a reference of the current new email message. This will allow me to run the macro which results in appending the required string.

Any help is appreciated.
e.g.

'this is just bad...
Sub DateTag()
'Dim MyMail As mailItem

Dim strID As String
Dim mailNS As Outlook.NameSpace
Dim mailItem As Outlook.mailItem

'strID = MyMail.EntryID

Set mailNS = Application.GetNamespace("MAPI")
Set mailItem = mailNS.GetItemFromID(strID)
mailItem.Subject = "date"
mailItem.Save

Set mailItem = Nothing
Set mailNS = Nothing
End Sub
Reply With Quote