How to e-mail a shortcut to the active workbook

G

Guest

I am using Office 2003 with Windows XP.

Anyone know how to e-mail a shortcut to the currently active workbook?
I have tried using the following code, but this sends a copy of the file not
a LINK or SHORTCUT to the original file:

Public Sub SendFileLink()
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 text"
.Body = "Body text"
.Display
.Attachments.Add ThisWorkbook.FullName, Type:=olByReference
End With
End Sub

Thanks much for your assistance.
 
D

Dave Peterson

Maybe just sending the link:

Option Explicit
Public Sub SendFileLink()
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 text"
.Body = "Body text" & vbLf & _
"file://" & _
Application.Substitute(ThisWorkbook.FullName, " ", "%20")
.Display
End With
End Sub

But if that workbook is in a folder in my C: drive, won't it be quite a
coicidence that you have one in the same exact location?

(disregard if your workbook is on a network drive)

And changing the backslashes to slashes makes it look pretty (but both worked ok
in Outlook--although neither worked in Outlook Express.

With oMessage
.Subject = "Subject text"
.Body = "Body text" & vbLf & _
"file://" & _
Application.Substitute(Application.Substitute _
(ThisWorkbook.FullName, " ", "%20"), "\", "/")
.Display
End With
 

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