Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hyperlinking to file

Status
Not open for further replies.

marshyrob

Technical User
Jan 20, 2004
137
GB
Hello All

I have a script which emails my team once a file has been created every sunday night. The file is named like so:

Backup Report For WC - 20060709.xls

I have this code in my script to send the mail:

Set SMTP = CreateObject("CDO.Message")

SMTP.From = "test@test.com"
SMTP.To = "test@test.com"
SMTP.Subject = "Check Backup Report"
SMTP.HTMLBody = "<li ><a href='x:\IT\Service Delivery\Production Environment Management\Networks and Telephony\Backups\Backup Reports\'>Backup Report</a></li>"
SMTP.Configuration.Fields.Item _
(" = 2

SMTP.Configuration.Fields.Item _
(" = "server"

SMTP.Configuration.Fields.Item _
(" = 25

SMTP.Configuration.Fields.Update

SMTP.Send

This all works fine, but the email creates a hyperlink to the folder where the file is located. I want the hyperlink, when clicked, to open the file. The the problem is the file is appended with the date each time its created.

How can i change this line:

SMTP.HTMLBody = "<li ><a href='x:\IT\Service Delivery\Production Environment Management\Networks and
Telephony\Backups\Backup Reports\'>Backup Report</a></li>"

To open a file with a different date each time. If it helps the date will always be a sunday!

Any help would be appreciated.

Cheers

Rob
 
Is it safe to assume that the date on which your script executes is the same date used on the file?

If so you could modify your script so that it uses the current data to build the hyberlink.
 
Hi Sheco

Yes thats what i want but im not too sure how to add that into the hyperlink.

My script uses StrDate to append to the file but ive tried adding that like so:

SMTP.HTMLBody = "<li ><a href='x:\IT\Service Delivery\Production Environment Management\Networks and
Telephony\Backups\Backup Reports\Weekly Report Strdate .xls'

Bt it just adds the word StrDate rather than the output?

Any ideas?

Cheers

Rob
 
you may try something like this:
SMTP.HTMLBody = "<li ><a href='x:\IT\Service Delivery\Production Environment Management\Networks and
Telephony\Backups\Backup Reports\Weekly Report [!]" & [/!]Strdate [!]& "[/!].xls'>Backup Report</a></li>"


Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Your script in the first post is doing exactly what you told it to do. It's opening the folder, because you haven't given it a filename to open.

Append the filename using the same routine you're using to create the filename to begin with. i.e.

strFileName = "Report" & Date & ".xls" (or whatever you're using to create the filename to begin with)

.... then include that in your path for your hyperlink....

SMTP.HTMLBody = "<li ><a href='x:\IT\Service Delivery\Production Environment Management\Networks and Telephony\Backups\Backup Reports\" & strFileName & "'>Backup Report</a></li>"




Just my 2¢

"In order to start solving a problem, one must first identify its owner." --Me
--Greg
 
Thanks Guys, as usual you have all helped me sort it out!

You guys rock!!

Rob

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top