AllenRitch
Technical User
I'm sending an e-mail from Access with the following code:
Dim outLookApp As Outlook.Application
Dim eMailItem As Outlook.MailItem
Dim strTo As Outlook.Recipient
Dim strCc As Outlook.Recipient
Dim strRecipient As String, strRecipient2 As String
strSubject = "Subject"
strBody = "Message"
Set outLookApp = New Outlook.Application
Set eMailItem = outLookApp.CreateItem(olMailItem)
Set strTo = eMailItem.Recipients.Add(strRecipient)
Set strCc = eMailItem.Recipients.Add(strRecipient2)
strCc.Type = olCC
With eMailItem
.Subject = strSubject
.Body = strBody
End With
eMailItem.Display
The problem with the code above is that it won't work unless Outlook is already opened. Is there anyway I can have the program look to see if Outlook is open or not? I plan on using the Shell function to open Outlook if it's closed.
Thanks
Dim outLookApp As Outlook.Application
Dim eMailItem As Outlook.MailItem
Dim strTo As Outlook.Recipient
Dim strCc As Outlook.Recipient
Dim strRecipient As String, strRecipient2 As String
strSubject = "Subject"
strBody = "Message"
Set outLookApp = New Outlook.Application
Set eMailItem = outLookApp.CreateItem(olMailItem)
Set strTo = eMailItem.Recipients.Add(strRecipient)
Set strCc = eMailItem.Recipients.Add(strRecipient2)
strCc.Type = olCC
With eMailItem
.Subject = strSubject
.Body = strBody
End With
eMailItem.Display
The problem with the code above is that it won't work unless Outlook is already opened. Is there anyway I can have the program look to see if Outlook is open or not? I plan on using the Shell function to open Outlook if it's closed.
Thanks