![]() |
How to e-mail a shortcut to the active workbook
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. |
How to e-mail a shortcut to the active workbook
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 quartz wrote: 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. -- Dave Peterson |
All times are GMT +1. The time now is 11:19 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com