srinivasbhaskar

New Member
Joined
Mar 22, 2010
Messages
3
Hi,

My first post here. Please excuse if any forum-rules have not been followed :)

I'm trying to send the contents from an Excel Worksheet through Outlook E-mail. The contents of the email comes from various sections of the Worksheet. Therefore, I'm using the following code to set up the "New E-mail" object.

__________________________________________________
Public Sub PublishMail()


Dim OutApp As Object
Dim Doc As Word.Document
Dim wdRn As Word.Range

With Application
.ScreenUpdating = False
.EnableEvents = False
End With

Set OutApp = CreateObject("Outlook.Application")
Set OItem = OutApp.CreateItem(0)
OItem.Display
OItem.Body = "" 'try DELETING

Set Doc = OutApp.ActiveInspector.WordEditor
wdRn.SetRange Doc.Range.Start, Doc.Range.Start

wdRn.Font.Name = "Calibri"
wdRn.Font.Size = 12

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

End Sub

_____________________________________________

This code gives me the dreaded "Object Variable or With block variable not set" error on the line highlighted in red.
wdRn.SetRange Doc.Range.Start, Doc.Range.Start

Any help is much appreciated.

Version Info:
Excel 2003
Outlook 2003
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.

Forum statistics

Threads
1,220,965
Messages
6,157,119
Members
451,398
Latest member
rjsteward

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top