?
Solved

Outlook

Posted on 2003-03-13
5
Medium Priority
?
254 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month7 days, 20 hours left to enroll

765 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