I received the following code from an EE member but it does not work with Outlook
Any ideas on how to modify it.
I pass to the function the parameters using a macro with the following function
FunctionName EmailFile ("Loudufresne@qwest.net",F:\Qwest\CopeXdock.mdb")
This is the code that does not work with Outlook.
Public Function EmailFile(ByVal strEmailAddress As String, ByVal strAttachmentLocation As String)
Dim appOutlook As Object
Dim emailItem As Object
Dim emailAttachments As Object
Dim emailAttach As Object
Set appOutlook = CreateObject("OutlookExpress.Application")
Set emailItem = appOutlook.CreateItem(0)
Set emailAttachments = emailItem.Attachments
Set emailAttach = emailAttachments.Add(strAttachmentLocation, 1)
emailItem.Subject = "Daily XDock Report (" & Format(Now(), "YYYYMMDD") & ")"
emailItem.Body = "Please find attached, Access Database containing today's Xdock data , Thank You." & vbCrLf
Set emailAttach = Nothing
Set emailAttachments = Nothing
Set emailItem = Nothing
Set appOutlook = Nothing