-
March 7th, 2017, 09:17 AM
#1
Problem with Outlook
Hi,
From my project I make a E-mail with attachment and than it goes to the outbox of Outlook.
This did work a long time good.
Since about two month I get the error 429 ActiveX component can't create object.
I have no idea why. Please help
Below is the code I use:
Code:
Dim patha As String
Dim result As Integer
Dim displaymessage As Boolean
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment
patha = "C:\temp\HATA814147586L02LA16010002160301.xml"
displaymessage = True
' Create the Outlook session.
Set objOutlook = CreateObject("Outlook.Application")
' Create the message.
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
With objOutlookMsg
' Add the To recipient(s) to the message.
Temp = "xxxx@xxxxx.nl"
Set objOutlookRecip = .Recipients.Add(Temp)
objOutlookRecip.Type = olTo
' ' Add the CC recipient(s) to the message.
' Set objOutlookRecip = .Recipients.Add("me@...")
' objOutlookRecip.Type = olCC
' Add the BCC recipient(s) to the message.
Set objOutlookRecip = .Recipients.Add("aaaaaa@aaaaaaaa.nl")
objOutlookRecip.Type = olBCC
' Set the Subject, Body, and Importance of the message.
.Subject = "Hierbij zenden wij de gegevens"
.Body = "This is the body of the message." & vbCrLf & vbCrLf
.Importance = olImportanceHigh 'High importance
' Add attachments to the message.
'If Not IsMissing(AttachmentPath) Then
Set objOutlookAttach = .Attachments.Add(patha)
'End If
' Resolve each Recipient's name.
For Each objOutlookRecip In .Recipients
objOutlookRecip.Resolve
Next
' Should we display the message before sending?
If displaymessage Then
.Display
Else
.Save
.Send
End If
End With
Set objOutlook = Nothing
End Select
..
-
March 7th, 2017, 09:46 AM
#2
Re: Problem with Outlook
Is the correct version of Outlook installed on the machine where you are trying to create the object?
-
March 7th, 2017, 11:23 AM
#3
-
March 7th, 2017, 08:11 PM
#4
Re: Problem with Outlook
Originally Posted by HermanTabbert
I am using outlook 2013
Ok. From my earlier question... Is the correct version of Outlook installed on the machine where you are trying to create the object? Have you upgraded Outlook since it quit working or have you used Outlook 2013 all along?
-
March 8th, 2017, 09:31 AM
#5
Re: Problem with Outlook
Arjay,
AS far as I know I have the correct version. Further, it is not only on my computer but also on the computers from my clients.
I think perhaps it has to do with an update from Microsoft.
-
March 8th, 2017, 10:10 AM
#6
Re: Problem with Outlook
This did work a long time good.
Since about two month I get the error 429 ActiveX component can't create object
I think perhaps it has to do with an update from Microsoft.
What version of Windows is being used?
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
-
March 10th, 2017, 06:28 AM
#7
-
March 10th, 2017, 12:00 PM
#8
Re: Problem with Outlook
Originally Posted by HermanTabbert
Arjay,
AS far as I know I have the correct version. Further, it is not only on my computer but also on the computers from my clients.
I think perhaps it has to do with an update from Microsoft.
There can be many variables that will cause something to quit working. It could be a Microsoft update or may be something else entirely like a change in Outlook's configuration, or some other client software. Even a permissions change may cause the error. Hopefully, your software logs error to a file or the event viewer where you can have your client send you the logs/errors. If not, perhaps you can send them and instrumented version of your software that does log so you can get more detailed error info.
-
April 9th, 2017, 01:01 PM
#9
Re: Problem with Outlook
This code works fine for me:
Code:
Dim olapp As Object
Dim oitem As Object
Txto$ = "Body Message you want to send"
Set olapp = CreateObject("Outlook.Application.15") '·········· > For new office versions
Set oitem = olapp.CreateItem(0) '·································· >
With oitem '··············································· > With created object
.Subject = "Resumen de Ingresos del " & Date '········· > EMail Subject
.To = "emailone@gmail.com" '··············· > Email account
.CC = "emailtwo@hotmail.com" '··················· > With copy
.Body = Txto$ '········································ > Mail content
.Attachments ("drive:\path\filename.extsn") '··················· >
.Send '················································ > Sends EMail
End With '······································· >
Set olapp = Nothing
Set oitem = Nothing
I hope this helps
PS no need to add a reference, you just have to have MSOffice installed. It may take a few seconds to deliver the MSG to outlook, depending on the PC you are using.
Last edited by 2kaud; April 9th, 2017 at 01:02 PM.
Reason: Added code tags
-
April 9th, 2017, 01:03 PM
#10
Re: Problem with Outlook
[When posting code, please use code tags rather than a different font. Go Advanced, select the formatted code and click '#'.]
Cheers!
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|