txgeekgirl
Registered User.
- Local time
- Yesterday, 16:42
- Joined
- Jul 31, 2008
- Messages
- 187
I have a DB that is hosted on my new blade. I had to change the way the DB sends auto emails because we put a 2003 Ent O/S on it with MO2003. On the old server we were running MO2000 to get around the security with auto emails.
I have some code that takes care of it in the new version but I cannot get the call code cleaned up enough to work.
BTW - we use this in-house for communications between referrals, svc coords, drs, and nurses. Nothing leaves the network.
If you all see anything - I would love to know what the issue is.
I have some code that takes care of it in the new version but I cannot get the call code cleaned up enough to work.
BTW - we use this in-house for communications between referrals, svc coords, drs, and nurses. Nothing leaves the network.
If you all see anything - I would love to know what the issue is.
Code:
'This is the procedure that calls the exposed Outlook VBA function...
Sub SendMessage(StrTo As String, strCC As String, strSubject As String, strMessageBody As String, Optional strAttachmentPaths As String)
Dim objOutlook As Object ' Note: Must be late-binding.
Dim objNameSpace As Object
Dim objExplorer As Object
Dim blnSuccessful As Boolean
Dim blnNewInstance As Boolean
Dim strDraft As String
'Is an instance of Outlook already open that we can bind to?
On Error Resume Next
Set objOutlook = GetObject(, "Outlook.Application")
On Error GoTo 0
MsgBox blnNewInstance
If objOutlook Is Nothing Then
'Outlook isn't already running - create a new instance...
Set objOutlook = CreateObject("Outlook.Application")
blnNewInstance = True
MsgBox blnNewInstance
'We need to instantiate the Visual Basic environment... (messy)
Set objNameSpace = objOutlook.GetNamespace("MAPI")
Set objExplorer = objOutlook.Explorers.Add(objNameSpace.Folders(1), 0)
objExplorer.CommandBars.FindControl(, 1695).Execute
objOutlook.Application.Visible = True
objExplorer.Close
Set objNameSpace = Nothing
Set objExplorer = Nothing
End If
MsgBox blnNewInstance
strDraft = "N"
MsgBox StrTo
MsgBox strCC
MsgBox strSubject
MsgBox strMessageBody
blnSuccessful = objOutlook.FnSendMailSafe(StrTo, strCC, "", _
strSubject, strMessageBody, _
strDraft, strAttachmentPaths)
If blnNewInstance = True Then objOutlook.Quit
Set objOutlook = Nothing
End Sub