Solved

Starting MS Outlook

Posted on 2004-09-06
7
234 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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

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…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
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…
Suggested Courses
Course of the Month6 days, 3 hours left to enroll

626 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