Emailing a Hyperlink of an Excel Workbook.

P

PaulW

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><br>Regards<br>Paul 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?
 
J

Joel

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
 

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