Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Qadriyah Malik   on Jan 23 In MS Office Category.

  
Question Answered By: Damon Perez   on Jan 23

There are significant differences between Outlook version  2000 and 2003.
If I were doing the coding, I would be sure and perform late binding to
let Excel & Outlook figure out how to allocate resources as appropriate.
Below is some code  I use to start an email  message from an Excel
spreadsheet. In it, I am only concerned with getting the addresses in
the bcc field, but you can see how I did it, and perhaps it will help
you.

#If EarlyBinding = 1 Then
Public objOLapp As Outlook.Application
Public objOLitem As Outlook.MailItem
#Else
Public objOLapp As Object
Public objOLitem As Object
#End If

Sub Test(strEmail As String)
On Error GoTo EH
Dim objOLapp As Object
Dim objOLitem As Object
Set objOLapp = CreateObject("Outlook.Application")
Set objOLitem = objOLapp.CreateItem(0)
With objOLitem
.Subject = ""
.CC = ""
.To = ""
.Body = ""
.bcc = strEmail
' .Attachments.Add '(path to the attachment,either hard coded or
variable)
.Display
End With
Set objOLapp = Nothing
Set objOLitem = Nothing
'Handle Errors Gracefully
Exit_EH:
Exit Sub

EH:
MsgBox Err.Number & ": " & Err.Description
Resume Exit_EH

End Sub

Share: 

 

This Question has 2 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on How to detect version....... Or get search suggestion and latest updates.


Tagged: