View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
tankerman tankerman is offline
external usenet poster
 
Posts: 60
Default Run-Time error 429

This is my code attached to a button, it fails on this line
Set OutApp = CreateObject("Outlook.Application")

Sub Mail_Sheet_Outlook_Body()
' Don't forget to copy the function RangetoHTML in the module.
' Working in Office 2000-2007
Dim rng As Range
Dim OutApp As Object
Dim OutMail As Object
With Application
.EnableEvents = False
.ScreenUpdating = False
End With

Set rng = Nothing
Set rng = ActiveSheet.UsedRange
'You can also use a sheet name
'Set rng = Sheets("YourSheet").UsedRange

Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)

On Error Resume Next
With OutMail
.Recipients.Add "ASPHALT H2S"
.CC = ""
.BCC = ""
.Subject = Range("E4")
.HTMLBody = RangetoHTML(rng)
.DISPLAY
End With
On Error GoTo 0

With Application
.EnableEvents = True
.ScreenUpdating = True
End With

Set OutMail = Nothing
Set OutApp = Nothing
End Sub

Any help would be appreciated

DWB


"tankerman" wrote:

When my company bought new computers I have started getting this error

Run-time error 429
ActiveX component can't create object

I know it's probably a reference but for the life of me I can not seem to
find which one it is.

Any help would be appreciated

DWB