Macro sending email how to disable warning?

  • Thread starter Thread starter Mitch
  • Start date Start date
M

Mitch

I know this must be asked a thousand times, but were do you go to get a
certificate to allow a macro to send a messages. Is there a cost?
The Macro works, just want to save time and not deal with a silly little
box. Lowering security wouldn't be the smartest thing to do so they can avoid
this.

Thanks,
Mitch
 
Which silly little box? What version of Outlook and is the macro running in
the Outlook VBA project?

If this is the security dialog warning that some code is doing something
then signing your VBA project won't help at all. In that case look at
http://www.outlookcode.com/article.aspx?id=52.

If the macro won't run at all due to High security then you can use the
self-generated certificate included in Office. You use the selfcert.exe
program to create the certificate. However that cert won't be recognized on
other machines. Each user would have to generate a cert and sign the VBA
project. You can google on "selfcert" for more information.

A cert traceable back to a CA (certificate authority) can be created in an
organization if you run a CA in the organization. Otherwise there are
commercial certificates available for Authenticode signing (class 3 cert)
from companies such as Verisign, Thawte, etc.
 
Outlook 2003,

VB here's a sample of the code. I removed the 2nd invite as it's the same
thing.
I'm looking up selfcert stuff for Outlook. Think it will work?

Sub Expire_Reminder()

Dim App
Dim Appmt
Dim FLName
Dim CompanyName
Dim DocType
Dim ExpireDate

Set App = CreateObject("Outlook.application")
Set Appmt = App.CreateItem(olAppointmentItem)

Appmt.MeetingStatus = olMeeting

FLName = InputBox("Enter First Last Name", "Name")
If FLName = "" Then Exit Sub

CompanyName = InputBox("Enter the Company Name", "Company Name")
If CompanyName = "" Then Exit Sub

DocType = InputBox("Enter one of the following Doc Types" &
Chr(13) & "WP, TRV, VR, TRP, SP or OTHER", "DocType")


Check = False
Do While Check = False
ExpireDate = InputBox("Enter Expire Date, Format: DD/MM/YYYY", "Document
Expire Date")
If IsDate(ExpireDate) = True Then Exit Do
If ExpireDate = "" Then Exit Sub
'Check if Value is a date
If IsDate(ExpireDate) = False Then
MsgBox "Sorry, but you did not enter a valid date."
End If
Loop

Dim ExpireDate1
Dim ExpireDate2

'Minus 90 days and store, minus 7 days and store
ExpireDate1 = DateAdd("d", -7, ExpireDate)

' Set app at start of day and uniquely identify Meeting item with *!* to
help processing

Appmt.Start = ExpireDate1 & " 8:00"
Appmt.Subject = "*!* " & FLName & " " & CompanyName & " " & DocType

Appmt.Duration = 15
Appmt.BusyStatus = Free

' Set app at start of day and uniquely identify Meeting item with *!* to
help processing

Set myRequiredAttendee = Appmt.Recipients.Add("TEST")
myRequiredAttendee.Type = olRequired
Set myRequiredAttendee1 = Appmt.Recipients.Add("TEST")
myRequiredAttendee1.Type = olRequired
Set myRequiredAttendee2 = Appmt.Recipients.Add("TEST")
myRequiredAttendee2.Type = olRequired

' Set as free time duration short 15 mins
Appmt.AllDayEvent = "false"
Appmt.ReminderSet = True
Appmt.ReminderMinutesBeforeStart = 15

' Send and save Meeting request
Appmt.Send
Appmt.Save



' Clear memory
Set Appmt = Nothing
Set App = Nothing

End Sub
 
I'm still unclear where this code is running. Is it in the Outlook VBA
project? If so the most likely reason that you're getting a security warning
is that you aren't using the trusted Application object in the Outlook VBA
project but instead are instantiating App using CreateObject(). That creates
an untrusted instance of the Outlook.Application object. Use Application
instead.

For macro code in Outlook VBA using SelfCert to sign your VBA project will
allow the code to run even with High security set.
 
Application eh, thanks for the tip. Just looking over the example, and I'm
not overly familiar with this. The code is running as a Macro in Outlook, I
created a button that activates it.
As for how to use this code, I tried a few different things and nothing
works. Kind of new, don't expect you to do it, but any tips would be useful.
I looked up application examples in the VB help file and this is what I get.
I think I'll work on certificate authorization.

Sub CreateMailItem()
Dim myolApp As Outlook.Application
Dim myItem As Outlook.MailItem
Set myolApp = CreateObject("Outlook.Application")
Set myItem = myolApp.CreateItem(olMailItem)
MsgBox myItem.Application.Version
End Sub


Sub CreateMailItem()
Set myItem = Application.CreateItem(olMailItem)
MsgBox myItem.Application.Version
End Sub
 
Yes, that's how you'd use Application, which as I mentioned is trusted by
Outlook.

Have you looked at the code samples and searched for keywords at
www.outlookcode.com? It has the largest selection of code examples out
there.
 
Never heard of the site before. Thank you for pointing it out!
I have looked around though.
 
Back
Top