Hi,
I have a form with:
- e-mail adress
- subject (text)
- reference (hyperlink to a pdf document on the server)
Now I have a VBA code who allows me to open an e-mail in outlook, with the e-mail adress, the subject and in the body the hyperlink: -
Dim mess_body As String
-
Dim appOutLook As Outlook.Application
-
Dim MailOutLook As Outlook.MailItem
-
Set appOutLook = CreateObject("Outlook.Application")
-
Set MailOutLook = appOutLook.CreateItem(olMailItem)
-
-
Set appOutLook = CreateObject("Outlook.Application")
-
Set MailOutLook = appOutLook.CreateItem(olMailItem)
-
With MailOutLook
-
.BodyFormat = olFormatRichText
-
.To = Me.emailadress
-
.Subject = Me.subject
-
.Body = Me.referece
-
Problem: the hyperlink in the e-mail is displayed as a text format (like a hyperlink is built in access)
For Example:
2000#P:\Representation\document2000.pdf#
What I want is that in the body of the e-mail, just the display text (here: 2000) is and that the link there still behind is (here: P:\Representation\document2000.pdf ) --> like it is on the access form
So that I can e-mail the link to a person (who has also access to the server) instead of sending the pdf file.
Can anyone help me? Has a tip?
Greetings and thanks,
Tonaldo
Ah sorry, I did not see about displaying the 2000.
I am not familiar with rtf syntax but if it might help, were you using an html formatted email instead, that would display your link as wanted -
Dim link As Variant
-
link = (Split(Me.Reference, "#"))
-
mylink = "<a href='" & link(1) & "'>" & link(0) & "</a>"
-
13 15568
.Body=Replace(Me.Reference, "#", "")
Thanks for the reply mariostg.
When I change:
.Body = reference
into:
.Body = Replace (Me.Reference, "#", "")
The body of my e-mail looks like:
2000P:\Representation\document2000.pdf
But the link doesn't work, only the # has disappeared...
Ah sorry, I did not see about displaying the 2000.
I am not familiar with rtf syntax but if it might help, were you using an html formatted email instead, that would display your link as wanted -
Dim link As Variant
-
link = (Split(Me.Reference, "#"))
-
mylink = "<a href='" & link(1) & "'>" & link(0) & "</a>"
-
Thanks for the advice.
Now I got this code: -
Dim link As Variant
-
link = (Split(Me.Reference, "#"))
-
mylink = "<a href='" & link(1) & "'>" & link(0) & "</a>"
-
-
Dim mess_body As String
-
Dim appOutLook As Outlook.Application
-
Dim MailOutLook As Outlook.MailItem
-
Set appOutLook = CreateObject("Outlook.Application")
-
Set MailOutLook = appOutLook.CreateItem(olMailItem)
-
-
Set appOutLook = CreateObject("Outlook.Application")
-
Set MailOutLook = appOutLook.CreateItem(olMailItem)
-
With MailOutLook
-
.BodyFormat = olFormatHTML
-
.To = Me.email
-
.Subject = Me.subject
-
.Body = mylink
-
The result in HTML code looks good (body e-mail):
<a href='P:\Representation\document2000.pdf'>2000</a>
Only problem is, using outlook2007 which doesn't allow using html code in their e-mail...
I did not know about that constraint in Office 2007, I am using Office 2003.
I suggest you open an rtf file that contains a hyperlink with something like TextPad so you can see the tags.
It would likely show something like this: -
{\field{\*\fldinst{HYPERLINK "\Representation\document2000.pdf#"}}{\fldrslt{\cf1\ul\f1 2000\f1 }}
-
Thanks again, Mariostg.
I understand what you want to say, but don't understand the code :-).
I don't really know where to paste that part in my VBA code... Can you help me? (sorry I just started learning working with VBA)
Any other suggestion to solve the problem?
I am guessing here as I am not familiar with rtf, but in my opinion, based on the provided sample code it would go like so -
mylink = "{\field{\*\fldinst{HYPERLINK "" \ " & link(1) & "#""}}{\fldrslt{\cf1\ul\f1" & link(0) & "\f1 }}"
-
Watch for the double quotes, it gets confusing...
I don't really understand the code, but I tried it, so I got this in my VBA... -
Dim link As Variant
-
link = (Split(Me.Reference, "#"))
-
mylink = "{\field{\*\fldinst{HYPERLINK "" \ " & link(1) & "#""}}{\fldrslt{\cf1\ul\f1" & link(0) & "\f1 }}"
-
-
Dim mess_body As String
-
Dim appOutLook As Outlook.Application
-
Dim MailOutLook As Outlook.MailItem
-
Set appOutLook = CreateObject("Outlook.Application")
-
Set MailOutLook = appOutLook.CreateItem(olMailItem)
-
-
Set appOutLook = CreateObject("Outlook.Application")
-
Set MailOutLook = appOutLook.CreateItem(olMailItem)
-
With MailOutLook
-
.BodyFormat = olFormatHTML
-
.To = Me.email
-
.Subject = Me.subject
-
.Body = mylink
-
The result in my e-mail is this:
{\field{\*\fldinst{HYPERLINK " \ P:\Representation\document2000.pdf#"}}{\fldrslt{\c f1\ul\f12151\f1 }}
Maybe you want to check this it should give you some rtf clues. http://www.microsoft.com/downloads/e...displaylang=en
I don't use Office 2007 so I can't really help further. I have a routine that creates html emails and it basically goes like so. It creates html formatted emails though. -
Function CreateMail(strTo, strCC, strTitle, strBody)
-
Dim objMailItem As Outlook.MailItem
-
Set olkapp = New Outlook.Application
-
Set olknamespace = olkapp.GetNamespace("MAPI")
-
Set objMailItem = olkapp.CreateItem(olMailItem)
-
With objMailItem
-
.To = strTo
-
.cc = strCC
-
'.Recipients.ResolveAll
-
.Subject = strTitle
-
'.Body = strBody
-
.Display
-
.HTMLBody = strBody
-
End With
-
-
Set objMailItem = Nothing
-
Set olknamespace = Nothing
-
Set olkapp = Nothing
-
End Function
-
Ok, thanks for the help Mariostg.
Looked into the rtf clues but didn't find a solution.
Anyone else has a suggestion to solve my problem?
okay, got an answer
just needed to add "file://"
But thanks Mariostg again, wouldn't have found it without your help! (to split the hyperlink first)!
Oh this is what you were looking for... :) Gee I use this all the time. You use <a href=... if you want to refer to a website. And file:// to refer to a file in a folder.
By the way, if you want to avoid problems with such links, avoid spaces when you name your files and folders.
Yeah, thanks for the help and the tips!
Sign in to post your reply or Sign up for a free account.
Similar topics
by: niv |
last post by:
i have a database, one of the fields is a hyperlink to a
htm file.
i want to activate it automaticly as the asp file is loaded
no click is needed.so that the background of the BODY part
will...
|
by: Salad |
last post by:
If I create a field as a hyperlink, Access will open the hyperlink if I
single click it.
Is there a method within the operating system that would tell access to
only open the hyperlink if...
|
by: c676228 |
last post by:
Hi,
I guess I am confused. In aspx script, I mean (you won't use
Codebehind="enrollinfo.aspx.vb", but mix code with html and code together)
You can access user control's property directly. Since I...
|
by: sweetpotatop |
last post by:
Hello,
I would like to create dynamic hyperlinks in a web page when it is
first loaded by using ASP.NET. Basically there will be a list of
documents in a folder and I will list them all as a...
|
by: Arthur Dent |
last post by:
Hello all.... i am REally confused by something...
I have a hyperlink control on my page, and for the NavigateUrl property, i
have it set to "~/" in the property window (without the quotes)....
|
by: Andy |
last post by:
Hi,
This is one of those things I thought should e easy...
I'm programatically trying to set the navigateURL property in a hyperlink in
the headertemplate of a repeater, but always get the...
|
by: Ruth |
last post by:
I need to modify my send email subroutine in VB6 to recognize hyperlinks when the user enters them in the textbox. I am using the CDO.Message object.
Any suggestions?
From...
|
by: Beefminator |
last post by:
Hello,
How can you create a hyperlink in the HTML body of CDOsys email? Line 7
is a link for yahoo.com, but the asp page does not work.
Set objMessage = CreateObject("CDO.Message")...
|
by: SBCUser666 |
last post by:
Form field (Text66) defined as Hyperlink.
Access 2003 table field defined as Hyperlink.
Using VBA I build the hyperlink and poke it into the form field. The field displays like it is a hyperlink...
|
by: ntcdwrg |
last post by:
I had been using a VBscript hyperlinking Access 2003 & ArcMap 9.1. Our software is updated to Access 2007 & ArcMap 9.3.1 and the hyperlink no longer works. Anyone else having this problem? Anyone...
|
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: 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,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
| |