Open Outlook from Access (1 Viewer)

Tsango

Registered User.
Local time
Today, 12:44
Joined
Mar 31, 2006
Messages
64
I have been trying to find out how to do this for ages...!

Does anyone know how to open Outlook from Access when Outlook is closed.

The main reason I need this is because my staff keep shutting Outlook down and so I do not get my automatic reports at the end of each day due to it...!! Then when someone opens Outlook all the backed up emails send!!!

I know how send an email from Access using Redemption so I do not need to know this. I need to know how to either send an email when Outlook is closed, or open Outlook up, send the messages and then maybe even shut it again.


Thanks in advance

OLI
 

Rickster57

Registered User.
Local time
Today, 05:44
Joined
Nov 7, 2005
Messages
431
Outlook

Did you do a SEARCH on this forum?
I thought there were several examples.
 

Tsango

Registered User.
Local time
Today, 12:44
Joined
Mar 31, 2006
Messages
64
Rickster57 said:
Did you do a SEARCH on this forum?
I thought there were several examples.

Yes I did and spent half a day trying some of them out but couldn't find anything that worked.

Maybe you could point me in the right direction.
 

Tsango

Registered User.
Local time
Today, 12:44
Joined
Mar 31, 2006
Messages
64
Last edited:

Summerwind

Registered User.
Local time
Today, 05:44
Joined
Aug 25, 2005
Messages
91
Here's a function I use that not only sends an e-mail but has an attachment as well.

Public Function MailOrderOut(SupAdd As String)
On Error GoTo ErrorHere

Dim olApp As New Outlook.Application, olNameSpace As Outlook.NameSpace
Dim myItem As Outlook.MailItem

Set olApp = Outlook.Application
Set olNameSpace = GetNamespace("MAPI")
Set myItem = olApp.CreateItem(olMailItem)

With myItem
.To = SupAdd
.Subject = "Purchase Order"
.Body = "Please find attached a parts purchase order"
.Importance = olImportanceHigh
.Attachments.Add (pubStoreString)
.Send
End With

ExitHere:
olApp.Quit
Set olApp = Nothing
Set olNameSpace = Nothing
Set myItem = Nothing
Exit Function
ErrorHere:
MsgBox Err.Description & " in procedure MailOrderOut"
Resume ExitHere
End Function
 

Kenln

Registered User.
Local time
Today, 08:44
Joined
Oct 11, 2006
Messages
551
Does this send the email without user intervention or does the user have to click send?
 

Kenln

Registered User.
Local time
Today, 08:44
Joined
Oct 11, 2006
Messages
551
Sorry I should have tried it first. I does want to send automatically but it was halted notifying the user that this application was trying to send an email. Do you want to continue.

It works GREAT just not completely in the background.
 

dungeon1970

New member
Local time
Today, 05:44
Joined
May 8, 2015
Messages
1
Hi, i have a problem with putting more than one attachment into an email, it works ok when i open outlook where it sends from the outbox but i would like it done automatically
I'm very new to this


Public Function SendEmailWithOutlook(MessageTo As String, Subject As String, MessageBody As String, eClubInfo As Boolean, eHandicaps As Boolean, eMeritTable As Boolean, eLeagueTable As Boolean, eFixtures As Boolean, eIndividuals As Boolean, ePairs As Boolean, eGarlicCup As Boolean)
' Define app variable and get Outlook using the "New" keyword
Dim olApp As New Outlook.Application
Dim mItem As Outlook.MailItem ' An Outlook Mail item

' Create a new email object
Set mItem = olApp.CreateItem(olMailItem)
' Add the To/Subject/Body to the message and display the message

With mItem
.To = MessageTo
.Subject = Subject
.body = MessageBody


If eClubInfo = True Then
.Attachments.Add "C:\Users\John\Documents\Access Databases\Reports\ClubInfo.pdf"
End If

If eHandicaps = True Then
.Attachments.Add "C:\Users\John\Documents\Access Databases\Reports\Handicaps.pdf"
End If

If eMeritTable = True Then
.Attachments.Add "C:\Users\John\Documents\Access Databases\Reports\MeritTable.pdf"
End If

If eLeagueTable = True Then
.Attachments.Add "C:\Users\John\Documents\Access Databases\Reports\LeagueTable.pdf"
End If

'If eFixtures = True Then
'.Attachments.Add "C:\Users\John\Documents\Access Databases\Reports\Fixtures.pdf"
'End If

If eIndividuals = True Then
.Attachments.Add "C:\Users\John\Documents\Access Databases\Reports\Individuals.pdf"
End If

If ePairs = True Then
.Attachments.Add "C:\Users\John\Documents\Access Databases\Reports\Pairs.pdf"
End If

If eGarlicCup = True Then
.Attachments.Add "C:\Users\John\Documents\Access Databases\Reports\GarlicCup.pdf"
End If



.DeleteAfterSubmit = True
.Send ' Send the message immediately

End With
olApp.Quit
' Release all object variables
Set mItem = Nothing
Set olApp = Nothing
End Function
 

Users who are viewing this thread

Top Bottom