View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Emailing a Hyperlink of an Excel Workbook.

You probably don't have the S: drive mapped the same. Drive using the
Network name of the drive instead of the S drive. Go to a window Explorer
(not internet) and go to menu Tools - Disconnect network dirve. You will see
the mapping of the S dirve. Replace S: path in your macro with \\Netowrk Name

"PaulW" wrote:

Sub mail_hyperlink()

Dim objoutlook As Object
Dim objolns As Object
Dim objrecipient As Object

filll = "file://S:\Call Stats Report\" & ActiveWorkbook.Name
namm = ActiveWorkbook.Name
mess = "<a href=""" & filll & """" & namm & "</a"

Set objoutlook = CreateObject("OUTLOOK.APPLICATION")

Set objolns = objoutlook.getnamespace("MAPI")
objolns.logon

With objoutlook.CreateItem(olMailItem)
.To = "paulwadsworth@XXX"
.Subject = "Daily Call Stats"
.HTMLBody = "Please find attached a hyperlink to the calls stats for
yesterday. <br" & mess _
& "<br<brRegards<brPaul Wadsworth."
.Save
.Send
End With

objolns.logoff

Set objoutlook = Nothing
Set objolns = Nothing
Set objrecipient = Nothing

End Sub

That code is Exactly as I have the email, the only thing changed is my email
address. I haven't left anything out.

When I run the macro the email sends fine, but when trying to open the
hyperlink I get a "Locate Link Browser" window, and under "Types of File" I
can only select "Executable File".

I've tried without "file://" i've also tried various number of " on the
"mess =" line.

Someone I know sent me a file to mail a hyper link and the code was totally
different:
Set olApp = New Outlook.Application
Instead, but still the same error occurs.

At the end of the day, i'm trying to stop sending files on email, and send
hyperlinks instead, so that people's emails are filled up with stuff.

Can anyone help me out?