14b3e creating an Outlook instance through Access VBA
Sign Up |  Live StatsLive Stats    Articles 37,317| Comments 177,147| Members 19,403, Newest Jassi1262| Online 527
Home Contact
 (Forgotten?): 
    Sikhism
    For best SPN experience, use Firefox Internet Browser!


                                                                   Your Banner Here!    




Sikh Philosophy Network » Sikh Philosophy Network » Current News » Information Technology » creating an Outlook instance through Access VBA

creating an Outlook instance through Access VBA

Our Donation Goal : Why Donate? : Donate Today! : Donate Anonymously (ਗੁਪਤ) : Our Family of Supporters
Goal this month: 500 USD, Received: 115 USD (23%)
Please Donate...
     
Related Topics...
Thread Thread Starter Forum Replies Last Post
Punjab to take media help for creating awareness on bird flu (Outlook India) Sikh News Reporter Sikh News 0 10-Aug-2007 03:30 AM
creating leave form from outlook email Sereana Tui Information Technology 1 28-Jul-2006 08:35 AM
Control Word Document/ Current Instance from within Access Gina Information Technology 9 16-Nov-2005 14:50 PM
Creating Access Application for PC w/o Access software Karl H Information Technology 7 28-Oct-2005 18:00 PM
Re: Open a second instance of MS Access 2000 .adp file from within my .mdb file wb Information Technology 0 27-Oct-2005 08:58 AM


Tags
creating, outlook, instance, through, access, vba
Reply Post New Topic In This Forum Stay Connected to Sikhism, Click Here to Register Now!
  #1 (permalink)  
Old 28-Jul-2006, 08:01 AM
sockalingans@gmail.com's Avatar sockalingans@gmail.com
Guest
 
Posts: n/a
   
   
creating an Outlook instance through Access VBA

  Donate Today!   Email to Friend  Tell a Friend   Show Printable Version  Print   Contact sikhphilosophy.net Administraion for any Suggestions, Ideas, Feedback.  Feedback  

Register to Remove Advertisements
good day. Within an existing Access DB application, we have built a
module to allow users to send emails (through Outlook). Manual
intervention is necessary, in that users have to click 'send', to send
the email.
Opening the first session, and closing it is not a problem. I am having
trouble starting a second-, third- instance of Outlook, though. This is
very sporadic, and only happening to one of perhaps twenty users of the
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/information-technology/9288-creating-outlook-instance-through-access-vba.html
application (residing in a common folder).
Any ideas?
We have checked the references, and version # of reference files and
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=9288
they are in sync with the PCs where this functionality is working just
groovy.

awaiting a speedy reply...

socka



Got anything to share on This Topic? Why not share your immediate thoughts/reaction with us! Login Now! or Sign Up Today! to share your views... Gurfateh!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 28-Jul-2006, 08:01 AM
Danny J. Lesandrini's Avatar Danny J. Lesandrini
Guest
 
Posts: n/a
   
   
Re: creating an Outlook instance through Access VBA

  Donate Today!  
Maybe I'm confused here, but are you allowed to open multiple sessions of
Outlook? In my experience, multiple instances (as viewed in Task Manager)
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=9288
suggest a failure of some kind, like Outlook failed to close due to Active
Sync being attached. I know that's not your problem, but my question is,
Why do you want to open multiple instances of Outlook?

Once Outlook is open, then additional requests should use the open session.
Below is some code that demonstrates this, using GetObject() first to see if
you can attach to an open session, and then CreateObject() if that fails.

I may be way off here, but if so, then I simply misunderstood the question.
--
Danny J. Lesandrini
dlesandrini@hotmail.com
http://amazecreations.com/datafast


wrote in message news:1147234225.881862.180130@i40g2000cwc.googlegr oups.com...
> good day. Within an existing Access DB application, we have built a
> module to allow users to send emails (through Outlook). Manual
> intervention is necessary, in that users have to click 'send', to send
> the email.
> Opening the first session, and closing it is not a problem. I am having
> trouble starting a second-, third- instance of Outlook, though. This is
> very sporadic, and only happening to one of perhaps twenty users of the
> application (residing in a common folder).
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=9288
> Any ideas?
> We have checked the references, and version # of reference files and
> they are in sync with the PCs where this functionality is working just
> groovy.
>
> awaiting a speedy reply...
>
> socka
>




Option Compare Database
Option Explicit

Dim mOutlookApp As Outlook.Application
Dim mNameSpace As Outlook.NameSpace
Dim mFolder As MAPIFolder
Dim mItem As MailItem
Dim fSuccess As Boolean


' First function sets the Outlook Application
' and Namespase objects and opens MS Outlook
Public Function GetOutlook() As Boolean
On Error Resume Next


' Assume success
fSuccess = True

Set mOutlookApp = GetObject(, "Outlook.application")


' If Outlook is NOT Open, then there will be an error.
' In case of error, attempt to open Outlook
If Err.Number > 0 Then
Err.clear
Set mOutlookApp = CreateObject("Outlook.application")

If Err.Number > 0 Then
MsgBox "Could not create Outlook object", vbCritical
fSuccess = False
Exit Function
End If
End If


' If we've made it this far, we have an Outlook App Object
' Now, set the NameSpace object to MAPI Namespace
Set mNameSpace = mOutlookApp.GetNamespace("MAPI")

If Err.Number > 0 Then
MsgBox "Could not create NameSpace object", vbCritical
fSuccess = False
Exit Function
End If

GetOutlook = fSuccess

End Function


' Next function reads user entered values and
' actually sends the message
Public Function SendMessage() As Boolean
On Error Resume Next

Dim strRecip As String
Dim strSubject As String
Dim strMsg As String
Dim strAttachment As String

strSubject = Nz(Me!txtSubject,"")
strRecip = Nz(Me!txtRecipient,"")
strMsg = Nz(Me!txtBody,"")
strAttachment = Nz(Me!txtAttachment,"")

If Len(strRecip) = 0 Then
strMsg = "You must provide a recipient."
MsgBox strMsg, vbExclamation, "Error"
Exit Function
End If


' Assume success
fSuccess = True

If GetOutlook Then
Set mItem = mOutlookApp.CreateItem(olMailItem)
mItem.Recipients.Add strRecip
mItem.Subject = strSubject
mItem.Body = strMsg

If Len(strAttachment) > 0 Then
mItem.Attachments.Add strAttachment
End If

mItem.Save
mItem.Send
End If

If Err.Number > 0 Then fSuccess = False
SendMessage = fSuccess

End Function


Reply With Quote
   Click Here to Donate Now!

Support Us!
Become a Promoter!
Gurfateh ji, you can become a SPN Promoter by Donating as little as $10 each month. With limited resources & high operational costs, your donations make it possible for us to deliver a quality website and spread the teachings of the Sri Guru Granth Sahib Ji, to serve & uplift humanity. Every contribution counts. Donate Generously. Gurfateh!
ReplyPost New Topic In This Forum Stay Connected to Sikhism, Click Here to Register Now!

Bookmarks


(View-All Members who have read this thread : 0
There are no names to display.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Tools Search
Search:

Advanced Search
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On

» Active Discussions
30 Day Amrit Vel 'a'...
By Ishna
Today 13:51 PM
35 Replies, 364 Views
Losing My Religion: Why...
Today 13:17 PM
3 Replies, 85 Views
Do you believe in...
Today 12:00 PM
184 Replies, 3,852 Views
What Do You Think of...
Today 11:59 AM
36 Replies, 640 Views
Thought of the Moment!
Today 10:07 AM
109 Replies, 5,117 Views
Amrit
Today 09:17 AM
5 Replies, 355 Views
What I believe Hukam to...
Today 03:15 AM
13 Replies, 160 Views
Should SPN Keep the...
Today 02:02 AM
19 Replies, 570 Views
Rozana Reports (ਪੰਜਾਬੀ...
Today 01:46 AM
304 Replies, 7,487 Views
Sikh Spokesman (ਪੰਜਾਬੀ...
Today 01:18 AM
173 Replies, 4,389 Views
Student Compares Toilet...
Today 01:05 AM
1 Replies, 77 Views
Map shows world's 'most...
Yesterday 18:58 PM
16 Replies, 285 Views
BHOOTS (Ghosts) and...
Yesterday 13:08 PM
102 Replies, 13,893 Views
How does Sikhi help you...
Yesterday 12:44 PM
17 Replies, 720 Views
Why are There so Many...
Yesterday 10:23 AM
70 Replies, 5,073 Views
» Books You Should Read...
Powered by vBadvanced CMPS v3.2.3
All times are GMT +6.5. The time now is 14:13 PM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2 Copyright © 2004-12, All Rights Reserved. Sikh Philosophy Network


Page generated in 0.37308 seconds with 32 queries
0