[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

Outlook

Posted on 2003-03-13
5
Medium Priority
?
255 Views
Last Modified: 2010-04-07
Hi
does anyone know how can i check if outlook is running,
and if not how can i start outlook via VB.6

Thanks
0
Comment
Question by:yanivnachumi1
4 Comments
 
LVL 11

Accepted Solution

by:
Steiner earned 120 total points
ID: 8127987
Add a reference to the Microsoft Outlook Object library and add the following code:

Private Sub Command1_Click()
   Dim OlApp As Outlook.Application
   
   On Error Resume Next
   Set OlApp = GetObject(, "Outlook.Application")
   If Err.Number = 429 Then               'Outlook not running, so start it
      MsgBox "Starting Outlook now..."
      Set OlApp = New Outlook.Application
   End If
   
   Set OlApp = Nothing
End Sub

This tries to get a running instance of Outlook. If none is found (creates an error number 429) then a new instance is openend.

Greets
Steiner
0
 
LVL 4

Expert Comment

by:Glowman
ID: 8128185
Yan,
I use outlook in some of my projects and I have discovered that if you make References to the MAPI controls and then after instantiating them write the line:

If MapiSession.SessionID=0 Then
  MapiSession.SignOn
End If

It will prompt the user to open outlook.  It will then be open but perhaps not visible to the user, but you can then programatically use Outlook.

G
0
 

Expert Comment

by:CleanupPing
ID: 8900158
yanivnachumi1:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Experts: Post your closing recommendations!  Who deserves points here?
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 9692842
Moderator, my recommended disposition is:

    Accept Steiner's comment(s) as an answer.

DanRollins -- EE database cleanup volunteer
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

590 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question