I am trying to send an email via Outlook.
Sub Mail_small_Text_Outlook()
'For Tips see: http://www.rondebruin.nl/win/winmail/Outlook/tips.htm
'Working in Office 2000-2013
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
strbody = "Hi there" & vbNewLine & vbNewLine & _
"This is line 1" & vbNewLine & _
"This is line 2" & vbNewLine & _
"This is line 3" & vbNewLine & _
"This is line 4"
On Error Resume Next
With OutMail
.To = "[email protected]"
.CC = ""
.BCC = ""
.Subject = "This is the Subject line"
.Body = strbody
'You can add a file like this
'.Attachments.Add ("C:\test.txt")
.Send 'or use .Display
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
At the line: Set OutApp = CreateObject("Outlook.Application")
, it gives an error:
runtime error '429': ActiveX Component can't create object.
I ran this line in cmd:
regsvr32 /i "c:\windows\system32\outlvba.dll".
It gives me this error:
The module "c:\windows\system32\outlvba.dll" failed to load.
Make sure the binary is stored at the specified path or debug it to check
for problems with the binary or dependent .DLL files. The specified
module could not be found.
Do you have the Click2Run edition of Office installed on the problematic PC?
The Click2Run edition of Office 2010 doesn't support automation. See Office 2010 Click-to-Run compatibility with add-ins for more information. Also you may find the How to: Verify Whether Outlook Is a Click-to-Run Application on a Computer article.
See You receive run-time error 429 when you automate Office applications for more information.