Solved

Starting MS Outlook

Posted on 2004-09-06
7
218 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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
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…

747 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

15 Experts available now in Live!

Get 1:1 Help Now