A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

"CreateObject("Outlook.Application")" does not work



 
 
Thread Tools Display Modes
  #1  
Old September 6th, 2005, 01:35 PM
Jeff Byrd
external usenet poster
 
Posts: n/a
Default "CreateObject("Outlook.Application")" does not work

I originally ment to post this in this newsgroup. Sorry for the dupilcate
posting. Any help would be appreciated.

I am Attempting to send e-mails to muultiple individuals from MS Access
2003. I use Outlook 2003 with an Exchange 2003 account.


I have Microsoft Outlook 11.0 Object Library checked in References. My code
compiles fine.

However when I try to run it I the following:

Private Sub CreateMail()
' Customize a message for each contact and then send or save the message
Dim intMessageCount As Integer
Dim mobjOutlook As Object

'Declare and instantiate a recordset object
Dim rst As ADODB.Recordset
Set rst = New ADODB.Recordset

'Open a recordset based on the result of qryBulkMail
rst.Open "qryTestemail", CurrentProject.Connection
intMessageCount = 0

Set mobjOutlook = CreateObject("Outlook.Application")

' Loop through the contacts in the open folder
Do Until rst.EOF

intMessageCount = intMessageCount + 1

rst.MoveNext
Loop

' Write the number of messages created to the worksheet
MsgBox intMessageCount & " Messages Sent"

End Sub

I get:

Run-time Error '-2147024770(8007007e)
Automation Error
The specific module could not be found.



I have also tried to run the following module.
Running the following Module returns the msg "Couldn't Launch Outlook!".

Function CreateOutlookObj() As Boolean

'Invoke error handling
On Error GoTo CreateOutlookObj_Err

'Assume a False return value
CreateOutlookObj = False

'Attempt to Launch Outlook
Set gobjOutlook = New Outlook.Application

'If Outlook launches successfully, return true
CreateOutlookObj = True

CreateOutlookObj_Exit:
Exit Function

CreateOutlookObj_Err:

'If an error occurs, display a message and return false
MsgBox "Couldn't Launch Outlook!!", vbCritical, "Warning!!"
CreateOutlookObj = False
Resume CreateOutlookObj_Exit
End Function

I have tried the last function for opening MS Word and MS Excel and they
work fine.

I am sure that I am missing something here but what? Does Outlook have some
addition security settings. We run an Etnerprise version of Norton Antivius
if that makes any difference.

Any thoughts?
--
Jeff Byrd



  #2  
Old September 6th, 2005, 02:28 PM
Douglas J Steele
external usenet poster
 
Posts: n/a
Default

There was a discussion about this problem in another one of the Access
newsgroups recently (sorry, I don't remember which one). The suggestion was
made that it might be worth posting to an Outlook-related group, in case
there's something new in the Outlook Security model that changes how you
automate it.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Jeff Byrd" wrote in message
...
I originally ment to post this in this newsgroup. Sorry for the dupilcate
posting. Any help would be appreciated.

I am Attempting to send e-mails to muultiple individuals from MS Access
2003. I use Outlook 2003 with an Exchange 2003 account.


I have Microsoft Outlook 11.0 Object Library checked in References. My

code
compiles fine.

However when I try to run it I the following:

Private Sub CreateMail()
' Customize a message for each contact and then send or save the

message
Dim intMessageCount As Integer
Dim mobjOutlook As Object

'Declare and instantiate a recordset object
Dim rst As ADODB.Recordset
Set rst = New ADODB.Recordset

'Open a recordset based on the result of qryBulkMail
rst.Open "qryTestemail", CurrentProject.Connection
intMessageCount = 0

Set mobjOutlook = CreateObject("Outlook.Application")

' Loop through the contacts in the open folder
Do Until rst.EOF

intMessageCount = intMessageCount + 1

rst.MoveNext
Loop

' Write the number of messages created to the worksheet
MsgBox intMessageCount & " Messages Sent"

End Sub

I get:

Run-time Error '-2147024770(8007007e)
Automation Error
The specific module could not be found.



I have also tried to run the following module.
Running the following Module returns the msg "Couldn't Launch Outlook!".

Function CreateOutlookObj() As Boolean

'Invoke error handling
On Error GoTo CreateOutlookObj_Err

'Assume a False return value
CreateOutlookObj = False

'Attempt to Launch Outlook
Set gobjOutlook = New Outlook.Application

'If Outlook launches successfully, return true
CreateOutlookObj = True

CreateOutlookObj_Exit:
Exit Function

CreateOutlookObj_Err:

'If an error occurs, display a message and return false
MsgBox "Couldn't Launch Outlook!!", vbCritical, "Warning!!"
CreateOutlookObj = False
Resume CreateOutlookObj_Exit
End Function

I have tried the last function for opening MS Word and MS Excel and they
work fine.

I am sure that I am missing something here but what? Does Outlook have

some
addition security settings. We run an Etnerprise version of Norton

Antivius
if that makes any difference.

Any thoughts?
--
Jeff Byrd





  #3  
Old September 6th, 2005, 02:53 PM
Jeff Byrd
external usenet poster
 
Posts: n/a
Default

Thank you I will try that also. Is there another way to send e-mail from
Access without using Oulook? We are running Exchange Server 2003.


"Douglas J Steele" wrote in message
...
There was a discussion about this problem in another one of the Access
newsgroups recently (sorry, I don't remember which one). The suggestion
was
made that it might be worth posting to an Outlook-related group, in case
there's something new in the Outlook Security model that changes how you
automate it.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Jeff Byrd" wrote in message
...
I originally ment to post this in this newsgroup. Sorry for the
dupilcate
posting. Any help would be appreciated.

I am Attempting to send e-mails to muultiple individuals from MS Access
2003. I use Outlook 2003 with an Exchange 2003 account.


I have Microsoft Outlook 11.0 Object Library checked in References. My

code
compiles fine.

However when I try to run it I the following:

Private Sub CreateMail()
' Customize a message for each contact and then send or save the

message
Dim intMessageCount As Integer
Dim mobjOutlook As Object

'Declare and instantiate a recordset object
Dim rst As ADODB.Recordset
Set rst = New ADODB.Recordset

'Open a recordset based on the result of qryBulkMail
rst.Open "qryTestemail", CurrentProject.Connection
intMessageCount = 0

Set mobjOutlook = CreateObject("Outlook.Application")

' Loop through the contacts in the open folder
Do Until rst.EOF

intMessageCount = intMessageCount + 1

rst.MoveNext
Loop

' Write the number of messages created to the worksheet
MsgBox intMessageCount & " Messages Sent"

End Sub

I get:

Run-time Error '-2147024770(8007007e)
Automation Error
The specific module could not be found.



I have also tried to run the following module.
Running the following Module returns the msg "Couldn't Launch Outlook!".

Function CreateOutlookObj() As Boolean

'Invoke error handling
On Error GoTo CreateOutlookObj_Err

'Assume a False return value
CreateOutlookObj = False

'Attempt to Launch Outlook
Set gobjOutlook = New Outlook.Application

'If Outlook launches successfully, return true
CreateOutlookObj = True

CreateOutlookObj_Exit:
Exit Function

CreateOutlookObj_Err:

'If an error occurs, display a message and return false
MsgBox "Couldn't Launch Outlook!!", vbCritical, "Warning!!"
CreateOutlookObj = False
Resume CreateOutlookObj_Exit
End Function

I have tried the last function for opening MS Word and MS Excel and they
work fine.

I am sure that I am missing something here but what? Does Outlook have

some
addition security settings. We run an Etnerprise version of Norton

Antivius
if that makes any difference.

Any thoughts?
--
Jeff Byrd







  #4  
Old September 6th, 2005, 03:01 PM
Douglas J Steele
external usenet poster
 
Posts: n/a
Default

Take a look at the Access EMail FAQ Tony Toews has at
http://www.granite.ab.ca/access/email.htm

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Jeff Byrd" wrote in message
...
Thank you I will try that also. Is there another way to send e-mail from
Access without using Oulook? We are running Exchange Server 2003.


"Douglas J Steele" wrote in message
...
There was a discussion about this problem in another one of the Access
newsgroups recently (sorry, I don't remember which one). The suggestion
was
made that it might be worth posting to an Outlook-related group, in case
there's something new in the Outlook Security model that changes how you
automate it.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Jeff Byrd" wrote in message
...
I originally ment to post this in this newsgroup. Sorry for the
dupilcate
posting. Any help would be appreciated.

I am Attempting to send e-mails to muultiple individuals from MS Access
2003. I use Outlook 2003 with an Exchange 2003 account.


I have Microsoft Outlook 11.0 Object Library checked in References. My

code
compiles fine.

However when I try to run it I the following:

Private Sub CreateMail()
' Customize a message for each contact and then send or save the

message
Dim intMessageCount As Integer
Dim mobjOutlook As Object

'Declare and instantiate a recordset object
Dim rst As ADODB.Recordset
Set rst = New ADODB.Recordset

'Open a recordset based on the result of qryBulkMail
rst.Open "qryTestemail", CurrentProject.Connection
intMessageCount = 0

Set mobjOutlook = CreateObject("Outlook.Application")

' Loop through the contacts in the open folder
Do Until rst.EOF

intMessageCount = intMessageCount + 1

rst.MoveNext
Loop

' Write the number of messages created to the worksheet
MsgBox intMessageCount & " Messages Sent"

End Sub

I get:

Run-time Error '-2147024770(8007007e)
Automation Error
The specific module could not be found.



I have also tried to run the following module.
Running the following Module returns the msg "Couldn't Launch

Outlook!".

Function CreateOutlookObj() As Boolean

'Invoke error handling
On Error GoTo CreateOutlookObj_Err

'Assume a False return value
CreateOutlookObj = False

'Attempt to Launch Outlook
Set gobjOutlook = New Outlook.Application

'If Outlook launches successfully, return true
CreateOutlookObj = True

CreateOutlookObj_Exit:
Exit Function

CreateOutlookObj_Err:

'If an error occurs, display a message and return false
MsgBox "Couldn't Launch Outlook!!", vbCritical, "Warning!!"
CreateOutlookObj = False
Resume CreateOutlookObj_Exit
End Function

I have tried the last function for opening MS Word and MS Excel and

they
work fine.

I am sure that I am missing something here but what? Does Outlook have

some
addition security settings. We run an Etnerprise version of Norton

Antivius
if that makes any difference.

Any thoughts?
--
Jeff Byrd









  #5  
Old September 6th, 2005, 03:37 PM
external usenet poster
 
Posts: n/a
Default

CDO is the most popular way to send emails from VB.. but you already
have the docmd.sendobject that can email access objects around.. i
reccomend using docmd.sendobject

in a real world environment; you might have to go with cdo.. ms just
sits there and prompts you a dozen times.. like that makes you more
secure lol

  #6  
Old September 8th, 2005, 06:33 PM
Jeff Byrd
external usenet poster
 
Posts: n/a
Default

Can I use an Outlook Template with DoCmd.SendObject. I am trying to send
e-mails to multiple addresses with different information inserted into each
e-mail.


wrote in message
ups.com...
CDO is the most popular way to send emails from VB.. but you already
have the docmd.sendobject that can email access objects around.. i
reccomend using docmd.sendobject

in a real world environment; you might have to go with cdo.. ms just
sits there and prompts you a dozen times.. like that makes you more
secure lol



  #7  
Old September 12th, 2005, 03:44 AM
Tony Toews
external usenet poster
 
Posts: n/a
Default

"Jeff Byrd" wrote:

Can I use an Outlook Template with DoCmd.SendObject.


No. SendObject has many limitations.

I am trying to send
e-mails to multiple addresses with different information inserted into each
e-mail.



To create a formatted document to send as an email you will need to
use VBA code to create a largish string. This string will then be
passed to the SendObject command or other method as the body of the
email. For more details including sample air code see my Tips page
on this topic at http://www.granite.ab.ca/access/email/formatted.htm.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 04:50 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.