473,396 Members | 1,785 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Adding a reference field to .htmlbody

Hello,

What's the best way to add a reference field to a .htmlbody of access db.
For example:
Expand|Select|Wrap|Line Numbers
  1. "Dear Mr. &![LName]&,"
Challenges on this code is it doesn't reference the field. It reads it as text.
Thank you!

-Alain
Dec 11 '14 #1

✓ answered by twinnyfo

Alain,

I can't specifically address the HTML aspect of this, as I have not had success with using HTML in VBA for sending e-mails.

However, concerning the code you posted, this will work better:
Expand|Select|Wrap|Line Numbers
  1. "Dear Mr. " & ![LName] & ","
It is important to get all the quotation marks in the right places.

12 1773
twinnyfo
3,653 Expert Mod 2GB
Alain,

I can't specifically address the HTML aspect of this, as I have not had success with using HTML in VBA for sending e-mails.

However, concerning the code you posted, this will work better:
Expand|Select|Wrap|Line Numbers
  1. "Dear Mr. " & ![LName] & ","
It is important to get all the quotation marks in the right places.
Dec 11 '14 #2
Once again, thank you!
Dec 11 '14 #3
twinnyfo
3,653 Expert Mod 2GB
Glad I can be of service!
Dec 11 '14 #4
Another issue, I'm trying to do page breaks. Was using
Expand|Select|Wrap|Line Numbers
  1. "Dear Mr. " & ![LName] & "," & <br/> & 
or
Expand|Select|Wrap|Line Numbers
  1. <br> </br>
or
Expand|Select|Wrap|Line Numbers
  1. & vbCrLf &
but that doesn't work. Also, adding formatting such as bolding the font. Thanks so much!
Dec 11 '14 #5
twinnyfo
3,653 Expert Mod 2GB
I have been playing with HTML just this morning!

Since E-Mail does not have a "page", that type of break won't really work here--it just adds another line. To Bold some text, add the following (assuming you have a String called strBody):

strBody = "This is <B>Bold</B> Text. This is <I>Italic</I>."

A quick list of some HTML tags can be found here:

HTML Tags

Hope this hepps.
Dec 11 '14 #6
twinnyfo
3,653 Expert Mod 2GB
P.S. Don't forget to declare the BodyFormat as HTML and use the .HTMLBody Property when sending.
Dec 11 '14 #7
Thanks! Well I got everything to work except for bolding the referenced field.

Expand|Select|Wrap|Line Numbers
  1. "Dear Mr. " & <b>![LName]</b> & ","
error is with
Expand|Select|Wrap|Line Numbers
  1. <b>![LName]</b>
as syntax error.
Dec 11 '14 #8
twinnyfo
3,653 Expert Mod 2GB
Try this:

Expand|Select|Wrap|Line Numbers
  1. "Dear Mr. <B>" & ![LName] & "</B>,"
Dec 11 '14 #9
Also, if anyone knows how to add the default signature from outlook to the
Expand|Select|Wrap|Line Numbers
  1. .htmlbody = strbody
. code.
Dec 11 '14 #10
Expand|Select|Wrap|Line Numbers
  1. "Dear Mr. <B>" & ![LName] & "</B>,"
Works!
Thank you!
Dec 11 '14 #11
Expand|Select|Wrap|Line Numbers
  1. 'GET DEFAULT EMAIL SIGNATURE
  2.     signature = Environ("appdata") & "\Microsoft\Signatures\"
  3.     If Dir(signature, vbDirectory) <> vbNullString Then
  4.         signature = signature & Dir$(signature & "*.htm")
  5.     Else:
  6.         signature = ""
  7.     End If
  8.     signature = CreateObject("Scripting.FileSystemObject").GetFile(signature).OpenAsTextStream(1, -2).ReadAll
  9. '-------------------------------------------------------------------------------------------------------------
Expand|Select|Wrap|Line Numbers
  1. strbody = "dear ....." & signature
  2. .htmlbody = strbody
VBA code for adding default signature from outlook to .htmlbody in access.

Thanks all!

-Alain
Dec 11 '14 #12
twinnyfo
3,653 Expert Mod 2GB
Your first block of code may work for a standard Windows machine, although I would declare separate strings for the Path and the actual signature. Also creates problems if there are multiple Signature blocks for the same user (I have two). However, when Windows starts moving stuff around again.....

I've been able to get the Signature block to appear in a blank e-mail, but haven't been successful in joining my HTMLBody with the signature block.

All research I have done has found solutions similar to what you have: find the signature file in the file structure. But, as mentioned, there are challenges with that.

Still lookin'.............
Dec 11 '14 #13

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Funnyweb | last post by:
When adding a field to a table using ALTER TABLE is it possible to check if the field already exits before the ADD command is run? If so how do I do this? Thanks Hamilton
5
by: Rose | last post by:
I want to use the javascript dom to reference the field of a record in a multi-record html form when that field has been changed. How do I reference the field? I have a JavaScript function coded...
3
by: kaston3 | last post by:
var totalpoints=0; for (counter=1;....){ myvalue=parseFloat(document.forms.elements.value); totalpoints+=myvalue //the fields in elements are always numbers }
11
by: Bobbak | last post by:
Hello All, I have these tables (lets call it ‘EmpCalls', ‘EmpOrders', and ‘Stats') that each contain the list of EmployeeIDs, I want to be able to create a Module in which I could call in my VB...
1
by: gary | last post by:
How do you add a field to the begining of the recordset. I need the new field to be the first field. Thanks
3
by: GL | last post by:
Hi, Is there a way to add a field to an existing table using a query of some sort (without needing to manually add a field to the table). I know how to do it with a make table query, but I have...
5
by: Michael Russell | last post by:
Hi all, Using C#, I've created a simple wrapper class for using Excel. I have Office Pro 2003 installed on my devel machine. The wrapper class works great, reading and writing to/from Excel. ...
0
by: Gambia Guy | last post by:
Trying to add a picture field to one of the tabs in MS Active Directory Users and Computers snap-in. Has anyone seen this done? Is it possible? I have found a Technet reference that adds a salary...
4
by: bdockery | last post by:
Access 2007 I have a table with three columns. Country, State, City What I want to do is have a form where the Country, and State, lookups auto-populate when the city lookup is chosen. It...
1
by: vinodkreddy1 | last post by:
hi good morning every body... i have a problem in adding Reference of any dll to asp.net 2005. i am trying to add dlls reference to asp.net application. but they r not adding to the reference...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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...
0
marktang
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,...
0
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...
0
Oralloy
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,...
0
jinu1996
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...
0
tracyyun
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 using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.