In my Access database I have a table with 2 fields: DOCNAME (Text) and WEBLINK (Hyperlink).
I have a VBA code for sending any data from this table by e-mail using CDO.Message function.
I can send web-links from WEBLINK field, but I need to hide it and instead the actual link to send the data from DOCNAME field.
For example, I fill the DOCNAME as “Contract” and WEBLINK as “http: //DomainName.com/Contract.pdf” (actual link to the document). Using the following code (part): - objMessage.TextBody = objMessage.TextBody & Split(rst![WEBLINK], "#")(2)
my recipient gets a link - http: //DomainName.com/Contract.pdf”
but how to hide it behind the clickable link “Contract” instead, or to send clickable link with the name of document from DOCNAME field.
Thanks
7 1538
I think as long as your email format is HTML, you can supply an <a> Tag with a HREF Attribute: - <a href="url">link text</a>
More info: http://www.w3schools.com/html/html_links.asp
So your code could look something like: -
objMessage.TextBody = objMessage.TextBody & "<a href=""" & Split(rst![WEBLINK], "#")(2) & """>" & Split(rst![WEBLINK], "#")(1) & "</a>"
that is if Split(rst![WEBLINK], "#")(1) contained the text you would like to display to the recipient.
Thanks, jforbes,
I've changed the code as per your proposal, but now get the line
as below
<a href="">http://DomainName.com/Contract.pdf</a>
in plain text format, not clickable
I've not developed code for emails in quite sometime, so I'm not an expert on it.
It looks like your getting an email with plain text or the text is being added to the email body as plain text. First thing I would do is make sure you are sending an email that is HTML. On the Email as it's being sent, or if you try to forward it, click on the Options Tab and you can see what the format is currently set to (Plain Text, HTML, Rich Text). If it's not HTML, then there is something that needs to be done to create the email in HTML.
If it is HTML, then you may want to try to use objMessage.HTMLBody instead of objMessage.TextBody. I only know this by looking at: http://www.rondebruin.nl/win/s1/cdo.htm zmbd 5,501
Expert Mod 4TB
Keep in mind...
My company's email policy strips out all HTML and RichText formatting from external emails - this is a common practice due to the high level of spam, phishing, and malware attacks that use concealed URL-Links.
Personally, and for the same reason my IT-Staff does, at home I have my email client set to force to plan-text.
In either case, the hyperlink is converted to the URL so it may be a "wasted" effort to attempt this process.
In any case please read the following thread (and there are several more like this here at Bytes - use he search feature at the top of any page :-) ) To put a hyperlink from access in body e-mail outlook
zmbd, thanks for reply, I know, some times it can be considered us spam, because of hidden URL links, but in my work I need to send a 10-15 attached files (documents) abt 5Mb total.
As a variant I think to send only links to these documents.
Documents stored in a cloudstorage but links stored in my database. Any idea how to realize it ?
After jforbes advice I've changed my code as follows : - objMessage.HTMLBody = "<a href=" & Split(rst![WEBLINK], "#")(1) &">rst![DOCNAME]</a>"
It works, but my recepient get get the plain text (rst![DOCNAME])instead of actual value from DOCNAME field.
How to set value from the field to display ?
zmbd 5,501
Expert Mod 4TB
You should do the SPLIT() first, Follow the link in my prior post, there's a working example and explanation therein... and post#13 in that thread.
For the .HTMLBody, you just want to create a string that fits into this pattern <a href="url">link text</a> . Where url is your URL and link text is the text to display. It looks like you can use single quotes in place of double quotes, so this <a href='url'>link text</a> should work also. Given this, I think this is more likely to work for you: - objMessage.HTMLBody = "<a href='" & Split(rst![WEBLINK], "#")(1) &"'>" & rst![DOCNAME] & "</a>"
Z's suggestion of splitting the Strings first is a pretty good one, especially to debug later. In fact creating the whole string for .HTMLBody up first might be best. This example is overkill, but it might help you: - DIM sLink AS String
-
DIM sDocName AS String
-
DIM sBody AS String
-
-
sBody = ""
-
sBody = sBody & "Here is your list of daily reports: " & vbCRLF
-
-
' Your OpenRecordset command
-
' Your For each OpenRecord
-
sLink = Split(rst![WEBLINK], "#")(1)
-
sDocName = NZ(rst![DOCNAME], sLink )
-
-
' Using replace is just another way to format the url
-
sBody = sBody & "<a href=""#Link#"">#DocName#</a>" & vbCRLF
-
sBody = Replace(sBody, "#Link#", sLink )
-
sBody = Replace(sBody, "#DocName#", sDocName )
-
' Move to NextRecord
-
-
sBody = sBody & "If you have any questions or wish to be " & vbCRLF
-
sBody = sBody & "removed from this email blast, contact " & vbCRLF
-
sBody = sBody & "CostasM at extension 1234"
-
-
Debug.Print sBody
-
objMessage.HTMLBody = sBody
-
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Akira |
last post by:
Could someone tell me how to send outlook appointment email from asp
page?
I would like appointment email just like one outlook can send out.
I tried to look for an answer for this, but it seems...
|
by: MLH |
last post by:
How does one create a hidden module in Access 97?
Why might one do so?
|
by: sam |
last post by:
Do anyone know how to apply send datagrid via email?
Any website for reference?
Please advise.
|
by: h.khalid11 |
last post by:
dear all,
I have a list of files that the path of that files are stored in a list
box, but now want to compress all these files stored in the list box
and send it by email from outlook.(I am using...
|
by: Dave S |
last post by:
I have a lot of forms on our web site that require the user to fill out
information and submit it back to us. currently the information comes back as
name value pair. The our employee's then has to...
|
by: JBuckner |
last post by:
My macro uses the Send Object (VBA Item.Send) function to email a
spreadsheet to an Outlook contact list. I want the function to be completely
automatic but Outlook displays a security warning...
|
by: jadeverell |
last post by:
Hi,
I have a database that contains information of contracts / tenders and need to do the following task:
* when a contract reaches its expiry date, i want to send an automated email to notify...
|
by: Ed Bitzer |
last post by:
Trying to send groups of email with program using System.Net.Mail. I
do not clear MailMessage but repeatedly loop changing only the Bcc
entries. Works fine if all addresses are valid. As a simple...
|
by: jkbhanuprakashreddy |
last post by:
Can some one help me how to send hidden variables in a URL?
|
by: Yousef Altaf |
last post by:
I have this code (it's a form which will sign up new users and send them an email to active they account).
<?php
if(isset($_POST)) {
$msg="";
$RFname =...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |