Help with Late Binding in Excel

J

justin.arnold2

I have a sheet that is currently being converted to a pdf and e-mailed
on a nightly basis. I have an e-mail sheet button that reaches out to
a .pdf, attaches it to a message, and sends the message. Everything
was written in Excel 2000 but when the sheet is opened in Excel 2003
and then re-opened in Excel 2000 the Outlook reference is still
looking for Outlook 11. I've read that I can alter the code to use
late binding to solve this problem however I have not been able to
implement this successfully with my code. Could someone take a look at
the code below and tell me how I can alter it to make it late binding?
Your help is appreciated. Thanks


'Email Sheet

Dim WhatFile As String
Dim distRecipients As String
Dim distcc As String

WhatFile = "C:\Documents and Settings\admin\My Documents
\Sheet.pdf"

distRecipients = "(e-mail address removed)"
'distcc ='

Dim olApp As New Outlook.Application
Dim Msg As Outlook.MailItem

Set Msg = olApp.CreateItem(olMailItem)
With Msg
.To = distRecipients
.CC = distcc
.Subject = "Gauge Sheet"
.Attachments.Add Source:=WhatFile
.Send
End With

Set Msg = Nothing
Set olApp = Nothing

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top