Solved

Starting MS Outlook

Posted on 2004-09-06
7
228 Views
Last Modified: 2010-05-02
How do i start MS Outlook in VB script please?
0
Comment
Question by:willwatters
[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
7 Comments
 
LVL 18

Accepted Solution

by:
JR2003 earned 50 total points
ID: 11989013
In vbscript:
Set myOlApp = CreateObject("Outlook.Application")
Set myNameSpace = myOlApp.GetNamespace("MAPI")
Set myFolder = _
    myNameSpace.GetDefaultFolder(olFolderInbox)
myFolder.Display





In VB6:
Private Sub Command1_Click()
    Dim myOlApp As Outlook.Application
    Set myOlApp = New Outlook.Application
    Dim myNameSpace As Outlook.NameSpace
    Dim myFolder As Outlook.MAPIFolder
    Set myNameSpace = myOlApp.GetNamespace("MAPI")
    Set myFolder = _
        myNameSpace.GetDefaultFolder(olFolderInbox)
    myFolder.Display
End Sub


See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbaol10/html/olobjApplication.asp
0
 
LVL 10

Expert Comment

by:anv
ID: 11989018
0
 
LVL 31

Expert Comment

by:merowinger
ID: 11989136
dim wshshell
set wshshell = CreateObject("Wscript.Shell")
wshshell.run("Outlook.exe")


mero
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 4

Expert Comment

by:hamood
ID: 11989289
what do you mean by start. If you want to use the different APIs related to outlook then you can use the methods mentioned in the above posts. If you want to launch outlook from your VB application then use this technique

Shell "D:\Program Files\Microsoft Office\Office10\outlook.exe", vbNormalFocus

execute the exe from its path


hamood
0
 
LVL 18

Expert Comment

by:JR2003
ID: 11989316
hamood,
that's ok to use that method if you know the path of outlook.exe, but what the vb script is used on a different machine where the installation path is different?
JR
0
 

Author Comment

by:willwatters
ID: 11995475
I tried this code, but i just want to outlook to open initially.  Outlook opens, but it doesn't show this as it is invisible.  I tried using i.e

Set myOlApp = CreateObject("Outlook.Application")
myOlApp.Visible = True

But this didn't work.
0
 
LVL 4

Expert Comment

by:hamood
ID: 11995577
This will not launch the outlook. It can used for calling Outlook API in the code. Secondly you have to add the reference of outlook APIs in the vb6 project.
Go to

Visual Studio --> Projects -->References --> select Miscorosoft Outlook 10.0 Object Library

For launching the outlook use the mehtod mentioned by me or by willwatters

Hamood
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Adding to a VBA? 6 85
Exit a vb6 apps when a calling it apps closes 15 58
Using an encrypted  value to decrypt and display contents in vb6 9 60
TT Auto Dashboard 13 101
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

749 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