Outlook 2003 Send Mail Security Prompts

  • Thread starter Thread starter John Eppley
  • Start date Start date
J

John Eppley

We have just moved from Outlook 2000 to Outlook 2003 and now we get the
security prompts when VBA code sends messages. I have been reading Sue
Mosher's advice on this problem in the newsgroups and need some
clarification. Sue states that "Outlook 2003 does not show security prompts
on three specific types of applications". One type she mentions is "Outlook
VBA code that uses the intrinsic Application Object". Can this be explained
further? The code below resides in Outlook 2003 and generates the security
prompts.

Sub Test_Send()
Dim MyOlApp As Outlook.Application
Dim MyMessage As Outlook.MailItem
Set MyOlApp = CreateObject("Outlook.Application")
Set MyMessage = MyOlApp.CreateItem(olMailItem)
With MyMessage
.Recipients.Add ("user@domain")
.Subject = "Test"
.Body = "This is a test."
.Send
End With
End Sub

Thanks John
 
Don't use CreateObject("Outlook.Application"). Use Application instead.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers


We have just moved from Outlook 2000 to Outlook 2003 and now we get the
security prompts when VBA code sends messages. I have been reading Sue
Mosher's advice on this problem in the newsgroups and need some
clarification. Sue states that "Outlook 2003 does not show security prompts
on three specific types of applications". One type she mentions is "Outlook
VBA code that uses the intrinsic Application Object". Can this be explained
further? The code below resides in Outlook 2003 and generates the security
prompts.

Sub Test_Send()
Dim MyOlApp As Outlook.Application
Dim MyMessage As Outlook.MailItem
Set MyOlApp = CreateObject("Outlook.Application")
Set MyMessage = MyOlApp.CreateItem(olMailItem)
With MyMessage
.Recipients.Add ("user@domain")
.Subject = "Test"
.Body = "This is a test."
.Send
End With
End Sub

Thanks John
 
To derive all objects from the intrinsic Application object in Outlook VBA
code instead of this:
Set MyOlApp = CreateObject("Outlook.Application")
Do this:
Set MyOlApp = Application
 
Works,
Thanks John

Ken Slovak - said:
To derive all objects from the intrinsic Application object in Outlook VBA
code instead of this:
Set MyOlApp = CreateObject("Outlook.Application")
Do this:
Set MyOlApp = Application
 
Back
Top