JamesCrawford
MIS
Hi all
A colleague of mine is developing an access database that sends an e-mail on the click of a button (the code is below), this works fine on her PC, but when I try and run the same process on my PC then I get the "Activex Component can't create object" error. We have both been looking at this issue for a while now and even after trawling the internet we have not found anything that works.
We have noticed that we are on different versions of outlook 2003, mine is 2003 (11.6568.6568) SP2. Has anybody got any ideas please - I have tried registering a number of DLL's but to no avail.
Any ideas greatly received.
-----------------------------------
Private Sub Command85_Click()
On Error GoTo Err_Command85_Click
Dim strDocName As String
Dim strticket, strBody, strDesc, strSubject, strEmail, strFoundingBody As String
Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem
strDocName = "Get assigned to"
DoCmd.OpenForm strDocName
DoCmd.Minimize
Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)
strticket = Forms![Input Ticket]!Text54
strEmail = Forms![Get assigned to]!EMail
strDesc = Forms![Input Ticket]!Text21
strFoundingBody = Forms![Get assigned to]![Founding Body]
strSubject = "Enquiry Reference - " & strticket
strSubject = strSubject & " Founding Body " & strFoundingBody
strBody = "Enquiry Reference " & strticket
strBody = strBody & " has been assigned to you. A description of the enquiry is shown below." & Chr(13) & Chr(13)
strBody = strBody & "Description:" & Chr(13) & Chr(13)
strBody = strBody & strDesc & Chr(13) & Chr(13)
strBody = strBody & "Kind Regards" & Chr(13) & Chr(13)
strBody = strBody & " Enquiry Centre" & Chr(13)
strBody = strBody & "t: 0000 000 000" & Chr(13)
strBody = strBody & "e: james@me.co.uk"
With objEmail
.To = strEmail
.Subject = strSubject
.Body = strBody
.Display
End With
Set objEmail = Nothing
DoCmd.Close acForm, strDocName
DoCmd.Close acForm, "Input Ticket"
Exit_Command85_Click:
Exit Sub
Err_Command85_Click:
MsgBox Err.Description
Resume Exit_Command85_Click
End Sub
----------------------------------
Many thanks
James
A colleague of mine is developing an access database that sends an e-mail on the click of a button (the code is below), this works fine on her PC, but when I try and run the same process on my PC then I get the "Activex Component can't create object" error. We have both been looking at this issue for a while now and even after trawling the internet we have not found anything that works.
We have noticed that we are on different versions of outlook 2003, mine is 2003 (11.6568.6568) SP2. Has anybody got any ideas please - I have tried registering a number of DLL's but to no avail.
Any ideas greatly received.
-----------------------------------
Private Sub Command85_Click()
On Error GoTo Err_Command85_Click
Dim strDocName As String
Dim strticket, strBody, strDesc, strSubject, strEmail, strFoundingBody As String
Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem
strDocName = "Get assigned to"
DoCmd.OpenForm strDocName
DoCmd.Minimize
Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)
strticket = Forms![Input Ticket]!Text54
strEmail = Forms![Get assigned to]!EMail
strDesc = Forms![Input Ticket]!Text21
strFoundingBody = Forms![Get assigned to]![Founding Body]
strSubject = "Enquiry Reference - " & strticket
strSubject = strSubject & " Founding Body " & strFoundingBody
strBody = "Enquiry Reference " & strticket
strBody = strBody & " has been assigned to you. A description of the enquiry is shown below." & Chr(13) & Chr(13)
strBody = strBody & "Description:" & Chr(13) & Chr(13)
strBody = strBody & strDesc & Chr(13) & Chr(13)
strBody = strBody & "Kind Regards" & Chr(13) & Chr(13)
strBody = strBody & " Enquiry Centre" & Chr(13)
strBody = strBody & "t: 0000 000 000" & Chr(13)
strBody = strBody & "e: james@me.co.uk"
With objEmail
.To = strEmail
.Subject = strSubject
.Body = strBody
.Display
End With
Set objEmail = Nothing
DoCmd.Close acForm, strDocName
DoCmd.Close acForm, "Input Ticket"
Exit_Command85_Click:
Exit Sub
Err_Command85_Click:
MsgBox Err.Description
Resume Exit_Command85_Click
End Sub
----------------------------------
Many thanks
James