Outlook 2003 Send Mail Security Prompts

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
 
S

Sue Mosher [MVP-Outlook]

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
 
K

Ken Slovak - [MVP - Outlook]

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
 
J

John Eppley

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
 

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