ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   email shortcut to active workbook as an outlook attachment (https://www.excelbanter.com/excel-programming/311767-email-shortcut-active-workbook-outlook-attachment.html)

Neil Deinhardt

email shortcut to active workbook as an outlook attachment
 
I work on a network with clients that are all running Windows NT4 and
Excel 97, but with a mix of Outlook 98 and 2000 (don't ask...). I'm
trying to develop a VBA procedure that runs from a command button in
an Excel workbook template. I would like the procedure to save and
email a shortcut to the active workbook (which resides on a file
server). So far, my attempts have failed miserably. I can get the
procedure to work by sending the actual file, but I cannot get it to
send a shortcut - the shortcut appears in the mail message at furst,
but disappears after it is sent.

The code I am using is as below:

Public Sub SendLink()
Dim oOutlook As New Outlook.Application
Dim oMessage As Outlook.MailItem
Dim wReviewSheet As Excel.Worksheet
Set oMessage = oOutlook.CreateItem(olMailItem)
ThisWorkbook.Save
With oMessage
.Subject = "Subject line text"
.Body = "Email body text"
.Display
.Attachments.Add ThisWorkbook.FullName, olByReference
End With
End Sub

As I have the Outlook 2000 email client, I have added the reference
for the Outlook 9.0 library.

The problem seems to relate to the olByReference property of the Add
method. If I use olByValue, the attachment is preserved after sending,
but is a copy of the actual file, not a shortcut.

The other thing I'm not sure of is whether this will work with clients
that have the Outlook 98 email client. I've added a reference to the
Outlook 9.0 library - will the other clients require access to the
Outlook 8.0 library?

Thanks in advance for any help on this issue,

Neil


All times are GMT +1. The time now is 02:10 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com