Hi all:
I ahve written the following code within a word doc to and added menu item to execute the comands ...
Option Explicit
Sub eMailActiveDocu ment()
Dim OL As Object
Dim EmailItem As Object
Dim Doc As Document
Application.Scr eenUpdating = False
Application.Scr eenUpdating = False
Set OL = CreateObject("O utlook.Applicat ion")
Set EmailItem = OL.CreateItem(o lMailItem)
Doc.Save
With EmailItem
.Subject = "AdHoc Request"
.To = "thndrbd2@yahoo .com"
'.Importance = olImportanceNor mal Or olImprotanceHig h Or olImprotanceLow
.Attachments.Ad d Doc.Adhocreques t.Doc
.Display
' .Send
End With
Application.Scr eenUpdating = True
Set Doc = Nothing
Set OL = Nothing
Set EmailItem = Nothing
End Sub
But when I run I receive a compile error referring to code:
Set EmailItem = OL.CreateItem(o lMailItem)
Any ideas why?
I ahve written the following code within a word doc to and added menu item to execute the comands ...
Option Explicit
Sub eMailActiveDocu ment()
Dim OL As Object
Dim EmailItem As Object
Dim Doc As Document
Application.Scr eenUpdating = False
Application.Scr eenUpdating = False
Set OL = CreateObject("O utlook.Applicat ion")
Set EmailItem = OL.CreateItem(o lMailItem)
Doc.Save
With EmailItem
.Subject = "AdHoc Request"
.To = "thndrbd2@yahoo .com"
'.Importance = olImportanceNor mal Or olImprotanceHig h Or olImprotanceLow
.Attachments.Ad d Doc.Adhocreques t.Doc
.Display
' .Send
End With
Application.Scr eenUpdating = True
Set Doc = Nothing
Set OL = Nothing
Set EmailItem = Nothing
End Sub
But when I run I receive a compile error referring to code:
Set EmailItem = OL.CreateItem(o lMailItem)
Any ideas why?
Comment