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