srinivasbhaskar
New Member
- Joined
- Mar 22, 2010
- Messages
- 3
Hi,
My first post here. Please excuse if any forum-rules have not been followed![Smile :) :)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
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
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