Dear All,
Office 2010
Access 2010 but still using an mdb-file for the moment.
Outlook is running an minimized and should stay active !!!
Each time I send an email Outlook opens a new session!
I opens the current session with: Set ObjOutlook = GetObject(,
"Outlook.application")
and closes with objOutlook.Session.Logoff
I can't see why it creates a new session ?
Filip
|
|
0
|
|
|
|
Reply
|
Filips
|
10/18/2010 5:16:43 PM |
|
Perhaps post the rest of your code. Perhaps you're inadvertently spawning
another session somewhere.
"Filips Benoit" <benoit.filips@telenet.be> wrote in message
news:Xj%uo.9360$HZ2.5190@newsfe30.ams2...
> Dear All,
>
> Office 2010
> Access 2010 but still using an mdb-file for the moment.
>
> Outlook is running an minimized and should stay active !!!
> Each time I send an email Outlook opens a new session!
>
> I opens the current session with: Set ObjOutlook = GetObject(,
> "Outlook.application")
> and closes with objOutlook.Session.Logoff
>
> I can't see why it creates a new session ?
>
> Filip
>
|
|
0
|
|
|
|
Reply
|
Douglas
|
10/18/2010 10:00:24 PM
|
|
The code !
------------------------------------------------------------------------------------------------------------------------------------------
Sub SendEmailNotVisible(EmailTo As String, Optional EmailSubject As String,
Optional EmailBody As String, Optional AttachmentPath)
On Error GoTo errHandling
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment
' Get the Outlook session.
Set objOutlook = GetObject(, "Outlook.Application")
' Create the message.
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
With objOutlookMsg
' Add the To recipient(s) to the message.
'Set objOutlookMailTo = .Recipients.Add(EmailRecipient)
'objOutlookRecip.Type = olTo
.To = EmailTo
' Add the CC recipient(s) to the message.
'Set objOutlookRecip = .Recipients.Add("nihil")
'objOutlookRecip.Type = olCC
' Set the Subject, Body, and Importance of the message.
If Not IsMissing(EmailSubject) Then .Subject = EmailSubject
If Not IsMissing(EmailBody) Then .Body = EmailBody
.Importance = olImportanceHigh 'High importance
' Add attachments to the message.
If Not IsMissing(AttachmentPath) Then
Set objOutlookAttach = .Attachments.Add(AttachmentPath)
End If
' Resolve each Recipient's name.
'For Each objOutlookRecip In .Recipients
' objOutlookRecip.Resolve
' Next
' Sending
.Send
End With
Set objOutlookAttach = Nothing
Set objOutlookRecip = Nothing
Set objOutlookMsg = Nothing
objOutlook.Session.Logoff
'objOutlook.Quit
Set objOutlook = Nothing
Exit Sub
errHandling:
objOutlookMsg.Close olDiscard
Set objOutlookMsg = Nothing
Set objOutlookAttach = Nothing
Set objOutlookRecip = Nothing
objOutlook.Quit
Set objOutlook = Nothing
MsgBox "Error in function SendEmailNotVisible: " & Err.Number & " " &
Err.Description
End Sub
---------------------------------------
"Douglas J Steele" <NOSPAM_djsteele@NOSPAM_gmail.com> wrote in message
news:i9ig1r$511$1@news.eternal-september.org...
> Perhaps post the rest of your code. Perhaps you're inadvertently spawning
> another session somewhere.
>
> "Filips Benoit" <benoit.filips@telenet.be> wrote in message
> news:Xj%uo.9360$HZ2.5190@newsfe30.ams2...
>> Dear All,
>>
>> Office 2010
>> Access 2010 but still using an mdb-file for the moment.
>>
>> Outlook is running an minimized and should stay active !!!
>> Each time I send an email Outlook opens a new session!
>>
>> I opens the current session with: Set ObjOutlook = GetObject(,
>> "Outlook.application")
>> and closes with objOutlook.Session.Logoff
>>
>> I can't see why it creates a new session ?
>>
>> Filip
>>
>
|
|
0
|
|
|
|
Reply
|
Filips
|
10/19/2010 7:32:22 AM
|
|
"Filips Benoit" <benoit.filips@telenet.be> wrote in message
news:6Sbvo.7940$J84.7130@newsfe27.ams2...
> The code !
> ------------------------------------------------------------------------------------------------------------------------------------------
> Sub SendEmailNotVisible(EmailTo As String, Optional EmailSubject As
> String, Optional EmailBody As String, Optional AttachmentPath)
>
> On Error GoTo errHandling
>
> Dim objOutlook As Outlook.Application
> Dim objOutlookMsg As Outlook.MailItem
> Dim objOutlookRecip As Outlook.Recipient
> Dim objOutlookAttach As Outlook.Attachment
>
> ' Get the Outlook session.
> Set objOutlook = GetObject(, "Outlook.Application")
>
> ' Create the message.
> Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
>
> With objOutlookMsg
> ' Add the To recipient(s) to the message.
> 'Set objOutlookMailTo = .Recipients.Add(EmailRecipient)
> 'objOutlookRecip.Type = olTo
> .To = EmailTo
>
> ' Add the CC recipient(s) to the message.
> 'Set objOutlookRecip = .Recipients.Add("nihil")
> 'objOutlookRecip.Type = olCC
>
> ' Set the Subject, Body, and Importance of the message.
> If Not IsMissing(EmailSubject) Then .Subject = EmailSubject
> If Not IsMissing(EmailBody) Then .Body = EmailBody
> .Importance = olImportanceHigh 'High importance
>
> ' Add attachments to the message.
> If Not IsMissing(AttachmentPath) Then
> Set objOutlookAttach = .Attachments.Add(AttachmentPath)
> End If
>
> ' Resolve each Recipient's name.
> 'For Each objOutlookRecip In .Recipients
> ' objOutlookRecip.Resolve
> ' Next
>
> ' Sending
> .Send
> End With
> Set objOutlookAttach = Nothing
> Set objOutlookRecip = Nothing
> Set objOutlookMsg = Nothing
>
> objOutlook.Session.Logoff
> 'objOutlook.Quit
> Set objOutlook = Nothing
>
> Exit Sub
>
> errHandling:
> objOutlookMsg.Close olDiscard
> Set objOutlookMsg = Nothing
> Set objOutlookAttach = Nothing
> Set objOutlookRecip = Nothing
> objOutlook.Quit
> Set objOutlook = Nothing
> MsgBox "Error in function SendEmailNotVisible: " & Err.Number & " " &
> Err.Description
>
> End Sub
Hmm. I don't see anything there that looks amiss.
I do question why you are shutting down the session of Outlook if you want
to use an active one...
|
|
0
|
|
|
|
Reply
|
Douglas
|
10/19/2010 10:39:05 PM
|
|
"Douglas J Steele" <NOSPAM_djsteele@NOSPAM_gmail.com> wrote in message
news:i9l6md$ob4$1@news.eternal-september.org...
> "Filips Benoit" <benoit.filips@telenet.be> wrote in message
> news:6Sbvo.7940$J84.7130@newsfe27.ams2...
>> The code !
>> ------------------------------------------------------------------------------------------------------------------------------------------
>> Sub SendEmailNotVisible(EmailTo As String, Optional EmailSubject As
>> String, Optional EmailBody As String, Optional AttachmentPath)
>>
>> On Error GoTo errHandling
>>
>> Dim objOutlook As Outlook.Application
>> Dim objOutlookMsg As Outlook.MailItem
>> Dim objOutlookRecip As Outlook.Recipient
>> Dim objOutlookAttach As Outlook.Attachment
>>
>> ' Get the Outlook session.
>> Set objOutlook = GetObject(, "Outlook.Application")
>>
>> ' Create the message.
>> Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
>>
>> With objOutlookMsg
>> ' Add the To recipient(s) to the message.
>> 'Set objOutlookMailTo = .Recipients.Add(EmailRecipient)
>> 'objOutlookRecip.Type = olTo
>> .To = EmailTo
>>
>> ' Add the CC recipient(s) to the message.
>> 'Set objOutlookRecip = .Recipients.Add("nihil")
>> 'objOutlookRecip.Type = olCC
>>
>> ' Set the Subject, Body, and Importance of the message.
>> If Not IsMissing(EmailSubject) Then .Subject = EmailSubject
>> If Not IsMissing(EmailBody) Then .Body = EmailBody
>> .Importance = olImportanceHigh 'High importance
>>
>> ' Add attachments to the message.
>> If Not IsMissing(AttachmentPath) Then
>> Set objOutlookAttach = .Attachments.Add(AttachmentPath)
>> End If
>>
>> ' Resolve each Recipient's name.
>> 'For Each objOutlookRecip In .Recipients
>> ' objOutlookRecip.Resolve
>> ' Next
>>
>> ' Sending
>> .Send
>> End With
>> Set objOutlookAttach = Nothing
>> Set objOutlookRecip = Nothing
>> Set objOutlookMsg = Nothing
>>
>> objOutlook.Session.Logoff
>> 'objOutlook.Quit
>> Set objOutlook = Nothing
>>
>> Exit Sub
>>
>> errHandling:
>> objOutlookMsg.Close olDiscard
>> Set objOutlookMsg = Nothing
>> Set objOutlookAttach = Nothing
>> Set objOutlookRecip = Nothing
>> objOutlook.Quit
>> Set objOutlook = Nothing
>> MsgBox "Error in function SendEmailNotVisible: " & Err.Number & "
>> " & Err.Description
>>
>> End Sub
>
> Hmm. I don't see anything there that looks amiss.
>
> I do question why you are shutting down the session of Outlook if you
> want to use an active one...
Perhaps the ( ' ) (ie, REM) here?
>> 'objOutlook.Quit
--
Clif McIrvin
Change nomail.afraid.org to gmail.com to reply by email.
(nomail.afraid.org has been set up specifically for
use in usenet. Feel free to use it yourself.)
|
|
0
|
|
|
|
Reply
|
clare.moe1 (2)
|
10/19/2010 11:08:28 PM
|
|
Before upgrating to Office 2010 in 2003 I used this code
Set objOutlook = CreateObject("Outlook.Application")
.....
objOutlook.Quit
It worked Ok in 2003 !!!
In 2010 it creates new session each time email-button is clicked!
Therefore I tried using
Set objOutlook = GetObject(, "Outlook.Application")
.............
objOutlook.Session.Logoff
Filip
"Douglas J Steele" <NOSPAM_djsteele@NOSPAM_gmail.com> wrote in message
news:i9l6md$ob4$1@news.eternal-september.org...
> "Filips Benoit" <benoit.filips@telenet.be> wrote in message
> news:6Sbvo.7940$J84.7130@newsfe27.ams2...
>> The code !
>> ------------------------------------------------------------------------------------------------------------------------------------------
>> Sub SendEmailNotVisible(EmailTo As String, Optional EmailSubject As
>> String, Optional EmailBody As String, Optional AttachmentPath)
>>
>> On Error GoTo errHandling
>>
>> Dim objOutlook As Outlook.Application
>> Dim objOutlookMsg As Outlook.MailItem
>> Dim objOutlookRecip As Outlook.Recipient
>> Dim objOutlookAttach As Outlook.Attachment
>>
>> ' Get the Outlook session.
>> Set objOutlook = GetObject(, "Outlook.Application")
>>
>> ' Create the message.
>> Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
>>
>> With objOutlookMsg
>> ' Add the To recipient(s) to the message.
>> 'Set objOutlookMailTo = .Recipients.Add(EmailRecipient)
>> 'objOutlookRecip.Type = olTo
>> .To = EmailTo
>>
>> ' Add the CC recipient(s) to the message.
>> 'Set objOutlookRecip = .Recipients.Add("nihil")
>> 'objOutlookRecip.Type = olCC
>>
>> ' Set the Subject, Body, and Importance of the message.
>> If Not IsMissing(EmailSubject) Then .Subject = EmailSubject
>> If Not IsMissing(EmailBody) Then .Body = EmailBody
>> .Importance = olImportanceHigh 'High importance
>>
>> ' Add attachments to the message.
>> If Not IsMissing(AttachmentPath) Then
>> Set objOutlookAttach = .Attachments.Add(AttachmentPath)
>> End If
>>
>> ' Resolve each Recipient's name.
>> 'For Each objOutlookRecip In .Recipients
>> ' objOutlookRecip.Resolve
>> ' Next
>>
>> ' Sending
>> .Send
>> End With
>> Set objOutlookAttach = Nothing
>> Set objOutlookRecip = Nothing
>> Set objOutlookMsg = Nothing
>>
>> objOutlook.Session.Logoff
>> 'objOutlook.Quit
>> Set objOutlook = Nothing
>>
>> Exit Sub
>>
>> errHandling:
>> objOutlookMsg.Close olDiscard
>> Set objOutlookMsg = Nothing
>> Set objOutlookAttach = Nothing
>> Set objOutlookRecip = Nothing
>> objOutlook.Quit
>> Set objOutlook = Nothing
>> MsgBox "Error in function SendEmailNotVisible: " & Err.Number & " " &
>> Err.Description
>>
>> End Sub
>
> Hmm. I don't see anything there that looks amiss.
>
> I do question why you are shutting down the session of Outlook if you want
> to use an active one...
>
|
|
0
|
|
|
|
Reply
|
Filips
|
10/20/2010 10:14:00 AM
|
|
|
5 Replies
370 Views
(page loaded in 0.073 seconds)
Similiar Articles: send email using Outlook opens new session each time I send an ...Dear All, Office 2010 Access 2010 but still using an mdb-file for the moment. Outlook is running an minimized and should stay active !!! Each time I send an email ... sending mail through Outlook - comp.soft-sys.matlabsend email using Outlook opens new session each time I send an ... sending mail through Outlook - comp.soft-sys.matlab send email using Outlook opens new session each time ... how to send mail to multiple recipients - comp.unix.admin ...send email using Outlook opens new session each time I send an ... how ... send email using Outlook opens new session each time I send an ... ... Resolve ... sending mail ... Access 2007 - Use Report or HTML file as body of Outlook email ...send email using Outlook opens new session each time I send an ..... Set the ... sending mail through Outlook - comp.soft-sys.matlab... email using Matlab, through Outlook ... Can't send messages via Thunderbird - comp.sys.mac.appsCan't send messages via Thunderbird - comp.sys.mac.apps ..... mac ... sending mail through Outlook - comp ... send email using Outlook opens new session each time I send ... attachments not showing up using Apple's mail app. - comp.sys.mac ...We use Google Apps for email (... ... not showing up using Apple's mail app. - comp.sys.mac ... Send ... some of the time, View -> Message -> Best ... ITunes opens but ... list posts in UTF-8 - comp.protocols.time.ntp... on my NNTP feed from my ISP, using Microsoft Outlook Express ... assume that is because we are both using the email ... as follows: Tools -> Options... -> Send -> News Sending ... What's the deal with Monotype Sorts in MS Office - comp.fonts ...Then, each time > you type t/ you will get the ... If it doesn't, can you at some point send ... in MS Office - comp.fonts ... linking xp outlook and bellsouth.net email ... Need a FORTRAN compiler for Win7 (or XP) - comp.lang.fortran ...Each time I go to another one, FF seems to ... none)): anonymous 331 Anonymous login ok, send your complete email ... 9.exe as I demo'ed for the anon ftp session, all ... High concurrency SELECT / UPDATE procedure - comp.databases.mysql ...But each client may use >> the same connection id untile the ... -- ===== Remove the "x" from my email address Jerry ... HOW TO USE Select "Fix Fonts Folder" to start the fix ... send email using Outlook opens new session each time I send an ...Dear All, Office 2010 Access 2010 but still using an mdb-file for the moment. Outlook is running an minimized and should stay active !!! Each time I send an email ... Delay or schedule sending e-mail messages - Outlook - Office.com... New Rule ... Send, each message remains in the Outbox folder for the amount of time you specified. Note If you are using a POP3 account, Outlook must ... sending email ... 7/27/2012 4:17:01 PM
|