Outlook 2003 automation- VB/VBA 'run time error 53' file not found

T

tom

Hi There

I am using a vb/vba application to send an email to various clients at
the end of a process.

I am using outlook 2003 as the email app where I have some macroes to
avoid the security pop up message when accessing the outlook from the
vb code.

the settings of the outlook are as follow:


1. the security level is on medium
2. have the spplication_startup method in this outlooksesion (shown
below) to enable the macroes.
3. security certified the shown below macroes.


when i try to run the vba code after i just opened the outlook i get:

'run time error 53' file not found

the error appears as i run callEMAIL......

//////////////////////////////////////////////////

have the follwoing code in VBA:

Sub test()

Dim EMAIL As Object
Set EMAIL = CreateObject("Outlook.application")
Call EMAIL.sendEMAIL("joe", "joe smith", "michelle poni", "joe smith",
"hello")
Set EMAIL = Nothing

End Sub

///////////////////////////////////

have the following code in ThisOutlookSesion:

Sub Application_Startup()
MsgBox ("Outlook is starting and enabling the macros!!")
End Sub

Public Sub sendEMAIL(subjST As String, sendTO As String, sendCC As
String, _
sendBCC As String, bodyPATH As String)

Dim objMsg As MailItem

' create new outgoing message
Set fso = CreateObject("scripting.filesystemobject")

Set objMsg = Application.CreateItem(olMailItem)

' your reminder notification address
objMsg.To = sendTO
objMsg.Subject = subjST
objMsg.Body = fso.opentextfile(bodyPATH).readall
objMsg.BCC = sendBCC
objMsg.CC = sendCC
objMsg.Importance = olImportanceHigh

' send the message
objMsg.Send


Set objMsg = Nothing
Set fso = Nothing

End Sub

any help would be appreciated

many thanks

tom
 

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