Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set oMailApp = CreateOject("Outlook.Application")

Status
Not open for further replies.

jmpWashDC

Technical User
Mar 19, 2002
35
US
hi, I am a new novice programmer...
and I'm trying to attach a Word document to an Outlook email that I open from Access....
here are a few lines of the code I am trying to use
Dim oMailApp As New Outlook.application
Dim oMail As MailItem
I don't understand these statements:

Set oMailApp = CreateOject("Outlook.Application")
Set oMail = oMailApp.CreateItem(olMailItem)

I get the following message:

compile error:
sub or function not defined

on the "CreateObject()" line...

So CreateObject is either a function or a subroutine, but what should CreateObject do?
Docmd.SendObject ?

I've already set the references to the object library on the VBA editor....

so now I'm stuck...

jmp
 
You misspelled the command. Try:
Set oMailApp = CREATEOBJECT("Outlook.Application")
Set oMail = oMailApp.CreateItem(olMailItem)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top