Opening Outlook from VB

B

Bob

I am using the SHELL command to open Outlook from VB 6.0
in Access using the following statement:

retval = Shell("Outlook.exe", 6)
or
retval = Shell("Outlook.exe", vbMinimizedNoFocus)

Outlook opens, but it is maximized and has focus.

Can anyone help me with this?

Thanks.
 
N

nath

-----Original Message-----
I am using the SHELL command to open Outlook from VB 6.0
in Access using the following statement:

retval = Shell("Outlook.exe", 6)
or
retval = Shell("Outlook.exe", vbMinimizedNoFocus)

Outlook opens, but it is maximized and has focus.

Can anyone help me with this?

Thanks.

.
set it up as an object

see below

Sub send_email(Optional AttachmentPath)

Dim Olook As Outlook.Application
Dim Olookmsg As Outlook.MailItem
Dim Olookrecip As Outlook.Recipient
Dim Olookatt As Outlook.Attachment

Set Olook = CreateObject("Outlook.Application")
Set Olookmsg = Olook.CreateItem(olMailItem)

olook.visible =true

With Olookmsg

Set Olookrecip = .Recipients.Add("Nathan_Grp")

Olookrecip.Type = olTo

.Subject = "This is an Automation test"
.Body = "Test of automation..." & vbCrLf & vbCrLf

.Importance = olImportanceHigh

If Not IsMissing(AttachmentPath) Then
Set Olookatt = .Attachments.Add(AttachmentPath)
End If

For Each Olookrecip In .Recipients
If Not Olookrecip.Resolve Then
Olookmsg.Display
End If
Next

.Send

End With

End Sub

You'll need to turn on your outlook refernces, tools,
references, remove the code you dont want.
 
B

Bob

Thanks for the help but I am having a problem getting it
to work.

I turned on the reference for Outlook and entered the
following commands in an attempt to simply open Outlook:

Dim Olook As Outlook.Application
Set Olook = CreateObject("Outlook.Application")
Olook.Application.Visible = True

When it hits the 3rd line, I get and error: "Object does
not suport this property or command."

I am a novice at Access and suspect that I am overlooking
something. Can you help?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top