Solved

Starting MS Outlook

Posted on 2004-09-06
7
219 Views
Last Modified: 2010-05-02
How do i start MS Outlook in VB script please?
0
Comment
Question by:willwatters
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

864 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now