Confidential mail macro

Joined
Feb 16, 2012
Messages
2
Reaction score
0
Hello, i am trying to write a macro in outlook 2003 to mark a new email confidential, and add "Confidential" to the beginning of the subject line. This is what i have so far:

Public Sub MakeThisConfidential()
Dim Message As Outlook.MailItem
Set Message = Outlook.ActiveInspector.CurrentItem
Message.Subject = "Confidential! - " & objMsg.Subject
Message.ActiveInspector.CurrentItem.Sensitivity = olConfidential
Message.ActiveInspector.CurrentItem.Save
End Sub

When i try to run it i get an error:
Runtime Error '91': Object variable or With block not set.

It says the error is with the set line.

Anyone have any ideas how to resolve this?
Any advice is very much appriciated!
Thanks!!
 
Joined
Feb 16, 2012
Messages
2
Reaction score
0
I solved the problem. the final product looks like this:

Sub Confidential()
Set myOlApp = CreateObject("Outlook.Application")
Set myItem = myOlApp.CreateItem(olMailItem)
myItem.Subject = "(Confidential)"
myItem.Sensitivity = olConfidential
myItem.Display
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top