ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   generating e-mail w/ links to excel file (https://www.excelbanter.com/excel-programming/450922-generating-e-mail-w-links-excel-file.html)

Matthew Dyer

generating e-mail w/ links to excel file
 
Sub Mail()
Dim TEMPfiles As String
TEMPfiles = "C:\CYCLE_DELQ\Files\06-05-2015"
Dim strTo As String, strBody As String
Dim OutApp As Object, OutMail As Object
strTo = "
strBody = "<HTML<BODYThank you and Have a Great Day!<br<br" & _
"<A href=" & TEMPfiles & "Temp</A</BODY</HTML"

Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)

On Error Resume Next
With OutMail
.to = strTo
.CC = ""
.BCC = ""
.Subject = "cycle_delq report"
.HTMLBody = strBody
.display
End With
On Error GoTo 0

Set OutMail = Nothing
Set OutApp = Nothing
End Sub

So i want the above code to create a hyperlink directly to the excel file so when you do the ctrl+click it opens up the excel file. currently formatted though it opens up the directory, not the file. I'm sure it has something to do with my HTML tagging. Can someone please help?

GS[_6_]

generating e-mail w/ links to excel file
 
Sub Mail()
Dim TEMPfiles As String
TEMPfiles = "C:\CYCLE_DELQ\Files\06-05-2015"
Dim strTo As String, strBody As String
Dim OutApp As Object, OutMail As Object
strTo = "
strBody = "<HTML<BODYThank you and Have a Great Day!<br<br" &
_ "<A href=" & TEMPfiles & "Temp</A</BODY</HTML"

Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)

On Error Resume Next
With OutMail
.to = strTo
.CC = ""
.BCC = ""
.Subject = "cycle_delq report"
.HTMLBody = strBody
.display
End With
On Error GoTo 0

Set OutMail = Nothing
Set OutApp = Nothing
End Sub

So i want the above code to create a hyperlink directly to the excel
file so when you do the ctrl+click it opens up the excel file.
currently formatted though it opens up the directory, not the file.
I'm sure it has something to do with my HTML tagging. Can someone
please help?


TEMPfiles does not point to a file!
OR
there's no file extension and so should only point to the directory!

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion



Matthew Dyer

generating e-mail w/ links to excel file
 
On Friday, June 5, 2015 at 10:03:22 PM UTC-7, GS wrote:
Sub Mail()
Dim TEMPfiles As String
TEMPfiles = "C:\CYCLE_DELQ\Files\06-05-2015"
Dim strTo As String, strBody As String
Dim OutApp As Object, OutMail As Object
strTo = "
strBody = "<HTML<BODYThank you and Have a Great Day!<br<br" &
_ "<A href=" & TEMPfiles & "Temp</A</BODY</HTML"

Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)

On Error Resume Next
With OutMail
.to = strTo
.CC = ""
.BCC = ""
.Subject = "cycle_delq report"
.HTMLBody = strBody
.display
End With
On Error GoTo 0

Set OutMail = Nothing
Set OutApp = Nothing
End Sub

So i want the above code to create a hyperlink directly to the excel
file so when you do the ctrl+click it opens up the excel file.
currently formatted though it opens up the directory, not the file.
I'm sure it has something to do with my HTML tagging. Can someone
please help?


TEMPfiles does not point to a file!
OR
there's no file extension and so should only point to the directory!

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion


So you mean if i want the link to open a file i need to put in the file name and not just the directory path? i guess that makes sense... :-) thanks for the help. sometimes it's just the silly simple things...

Claus Busch

generating e-mail w/ links to excel file
 
Hi Matthew,

Am Sat, 6 Jun 2015 10:07:36 -0700 (PDT) schrieb Matthew Dyer:

So you mean if i want the link to open a file i need to put in the file name and not just the directory path? i guess that makes sense... :-) thanks for the help. sometimes it's just the silly simple things...


Try:

Sub Mail()
Dim TEMPfiles As String
Dim strTo As String, strBody As String
Dim OutApp As Object, OutMail As Object

TEMPfiles = "C:\CYCLE_DELQ\Files\06-05-2015"
strTo = "
strBody = "Thank you and Have a Great Day!"

Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)

On Error Resume Next
With OutMail
.to = strTo
.CC = ""
.BCC = ""
.Subject = "cycle_delq report"
.HTMLBody = "<HTML<BODY" & strBody & "<br<br" & _
"<a href=" + TEMPfiles + "TEMPfiles</a</BODY</HTML"
.display
End With

Set OutMail = Nothing
Set OutApp = Nothing
End Sub


Regards
Claus B.
--
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional


All times are GMT +1. The time now is 05:33 PM.

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