Outlook Automation

F

Fred Zuckerman

I have the following code behind a command button.
How can I get the Outlook application to become the active/visible window so
the user can use their addressbook to select recipients?

Private Sub CommandButton1_Click()
If MsgBox("Ready To Send Email?", vbYesNo) = vbYes Then
Dim oOutlookApp As Outlook.Application
Dim oItem As Outlook.MailItem
Set oOutlookApp = CreateObject("Outlook.Application")
Set oItem = oOutlookApp.CreateItem(olMailItem)
oItem.Subject = "GST Recap For " & Me.TextBox1
oItem.Body = "Team = " & Me.ComboBox1 & vbCrLf & _
"Ofcr = " & Me.TextBox3 & vbCrLf & _
Me.TextBox4
oItem.Send
Set oItem = Nothing
Set oOutlookApp = Nothing
End If
End Sub


I tried inserting the following line, but it doesn't work:

oOutlookApp.Application.Visible

Thanks In Advance,
Fred Zuckerman
 
D

Doug Robbins - Word MVP

Try .Activate

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

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