Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default OLE Automation and Mutliple Office Releases

I recently wrote a macro to create an email from Excell. It works fine on my
machine (using Office 2002). When I try to run it on on an office 2000
machine it faults out. I know it is a reference library issue, but I don't
know how to handle it. Here is a sample of my code:

Sub Mailto(myMessage)

Dim OLF As Outlook.MAPIFolder
Dim olMailItem As Outlook.MailItem
Dim ToContact As Outlook.Recipient
mySubject = Range("AK2")
myFilename = Range("AK3")
myMailTo1 = Range("AM4")

'Save Current File
ActiveWorkbook.SaveCopyAs (myFilename)
'Create Email
Set OLF = GetObject("", _

"Outlook.Application").GetNamespace("MAPI").GetDef aultFolder(olFolderInbox)
Set olMailItem = OLF.Items.Add
olMailItem.Subject = mySubject
With olMailItem
Set ToContact = .Recipients.Add(myMailTo1)
.Body = myMessage
.Attachments.Add myFilename, olByValue, , _
"Attachment"
.Display
End With
Set ToContact = Nothing
Set olMailItem = Nothing
Set OLF = Nothing
Set fs = CreateObject("Scripting.FileSystemObject")
fs.deletefile (myFilename)
End Sub
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I incorporate a formula to calculate many months releases? soconfused Excel Worksheet Functions 3 October 23rd 08 08:49 PM
Office automation problem vba_nerd Excel Programming 0 April 6th 06 11:31 AM
MS Office VBA Automation Specialist salooha Excel Discussion (Misc queries) 0 August 15th 05 07:57 PM
asp.net Office Automation - in or out of process David Laub Excel Programming 4 April 27th 04 10:17 PM
Office automation application which will work with any version of office C#.NET Silly Programmer Excel Programming 1 February 21st 04 10:54 AM


All times are GMT +1. The time now is 06:18 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"