473,387 Members | 1,903 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,387 software developers and data experts.

Email body in italics

116 100+
Please can anyone help. I am sure this is quite simply. I am using a code similar to the one below. I want to make the .body = "this is the body of the message" in bold and italic. How can i do this.

Many thanks

jacc14




Sub Senmail()
Dim objOutlook As Object
Dim objOutlookMsg As Object
Set objOutlook = CreateObject("Outlook.Application")
Set objOutlookMsg = objOutlook.CreateItem(0)
With objOutlookMsg
.To = "test@test.net"
.CC = "name@email.com"
.Subject = "A scheduling request document # " & Doc_ID & "needs your attention."
.Body = "This is the body of message"
End With
Set objOutlookMsg = Nothing
Set objOutlook = Nothing
End Sub
Aug 23 '07 #1
17 19103
Rabbit
12,516 Expert Mod 8TB
Try using html code.
Aug 23 '07 #2
jacc14
116 100+
Hi Unfortunately I dont know html. How would i put this in my vb script??

Thanks

jacc14
Aug 24 '07 #3
take a look at this site by the way that email code is great isn't it same on I use
http://forum.statcounter.com/vb/misc.php?do=bbcode
Aug 24 '07 #4
Rabbit
12,516 Expert Mod 8TB
I don't think vBulletin codes work in e-mail documents.
Aug 24 '07 #5
Rabbit
12,516 Expert Mod 8TB
Expand|Select|Wrap|Line Numbers
  1. Sub CreateHTMLMail()
  2. 'Creates a new e-mail item and modifies its properties.
  3.  
  4.     Dim olApp As Outlook.Application
  5.     Dim objMail As MailItem
  6.     Set olApp = Outlook.Application
  7.     'Create mail item
  8.     Set objMail = olApp.CreateItem(olMailItem)
  9.  
  10.     With objMail
  11.        'Set body format to HTML
  12.        .BodyFormat = olFormatHTML
  13.        .HTMLBody = "HTML Code Here"
  14.        .Display
  15.     End With
  16.  
  17. End Sub
  18.  
There's plenty of HTML tutorials online.
Aug 24 '07 #6
jacc14
116 100+
Thanks for your reply. Looks like you are right as the vBulletin codes dont seem to work.

Unfortunately I am pretty new to all this and the body of the letter is probably far too complex for me to convert to HTML as it includes text boxes from the main form. I will do as you suggest and look for some on line help. Can you include text boxes from the main form before I start??

This is what the body looks like before I even start to convert it. It works fine using the old method but unfortunately I cant use italics on the sentence that i want (me.briefProblem).

.HTMLBody = .Body = "Dear" & Me.Complainent_first & _
vbCr & vbCr & "Thank you for your " & Me.Howreported & " in reference to the above job. " & _
"Your business is important to our company and I am extremely sorry you are not happy with the product you have received in relation to " & Me.BriefProblem & "." & vbCr & vbCr & _
"Details have been logged as follows:- " & _
Me.Details_of_Problem & vbCr & vbCr & _
"We are taking this matter very seriously and I am personally facilitating an investigation into the problem. You will receive a response within " & Me.ResponseTime & "." & vbCr & vbCr & _
"Once again, on behalf of our company, I am sorry for any inconvenience we may have caused." & vbCr & vbCr & _
"Kind regards" & vbCr & vbCr & _
Me.[knownas] & vbCr & vbCr & vbCr & vbCr & vbCr & vbCr & vbCr & _
"Please note:- This email has been generated from our new system created in-house in order to ensure our customers receive acceptable feedback in an allotted timescale in the unfortunate event that they are unhappy with the service received. Any feedback would be appreciated." & _
vbCr & vbCr & vbCr & "Best regards" & vbCr & vbCr & "CDavies "


Thanks for your help.
Aug 25 '07 #7
jacc14
116 100+
ok so first bash at this.

.Subject = "THIS IS A TEST - CDAVIES - Your job number " & Me.Job_No & " - " & Me.Magazine_Title



.BodyFormat = olFormatHTML
.HTMLBody = [html]

[Body] "this is a tst"




[/body]
[/html]



unfortunately the subject appears but the body of the letter is blank.??

Jacc14
Aug 26 '07 #8
Rabbit
12,516 Expert Mod 8TB
ok so first bash at this.

.Subject = "THIS IS A TEST - CDAVIES - Your job number " & Me.Job_No & " - " & Me.Magazine_Title



.BodyFormat = olFormatHTML
.HTMLBody = [html]

[Body] "this is a tst"




[/body]
[/html]



unfortunately the subject appears but the body of the letter is blank.??

Jacc14
1) You can't separate it over multiple lines like that.
2) html tags use < > not [ ].
Aug 26 '07 #9
jacc14
116 100+
Hi
I have tried <body> but it just get syntax error everytime. Is there something in the reference library I should be ticking.

Sorry for being a pain.

jacc14
Aug 27 '07 #10
Rabbit
12,516 Expert Mod 8TB
What's your new code look like?
Did you surround everything with quotes?

No references needed, this is just the format of the an html formatted message. It never gets evaluated by Access, only the receiving mail program will have to evaluate it.
Aug 27 '07 #11
jacc14
116 100+
Its simply


.BodyFormat = olFormatHTML
HTMLBody = <Body>"hello"</body>


if i exclude the quotation marks I still get the same error.

jacc14
Aug 27 '07 #12
Rabbit
12,516 Expert Mod 8TB
It should be
Expand|Select|Wrap|Line Numbers
  1. .HTMLBody = "<html><body><i>Test</i></body></html>"
Aug 27 '07 #13
jacc14
116 100+
Thats brilliant now I understand where I am going wrong.

Do you know if I can include a field from my access form within the letter. In the old format I just add & me.howreported but HTML doesnt recognise this.

Thanks for you patience.

Jacc14
Aug 27 '07 #14
Rabbit
12,516 Expert Mod 8TB
No problem.
Expand|Select|Wrap|Line Numbers
  1. .HTMLBody = "<html><body><i>" & Me.SomeField & "</i></body></html>"
Aug 27 '07 #15
jacc14
116 100+
Wonderful. So far so good. Just in process now of hopefully completing.

Thanks for your help.

Jacc14
Aug 29 '07 #16
Rabbit
12,516 Expert Mod 8TB
Not a problem, good luck.
Aug 29 '07 #17
jacc14
116 100+
Hi.
I know this is quite an old request but need to enhance this code.
I need to send a copy of the email to the person whom raised it. Is there a way of doing this as there is no where in the database that shows who has raised it so thought there may be a simply way to write it in the code when the email is launched.?? There are several users of the database and no one logs in so I cant use this.

Thanks

jacc14
Jul 22 '08 #18

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

Similar topics

1
by: dave | last post by:
Hi There Is there any how can we attach html page into email body by just encoding url ? something like with oMsg .From="blah blah blah" .To="abc@xyz.com" .body=www.mysite.com/default.htm...
6
by: mike | last post by:
I have created a side application in VB.NET which reads rows from a DB and builds an email message. when i have a long string the the mailmessage.body or the mailmessage, it puts in an...
16
by: TJO | last post by:
I am trying to pre populate an email body using javascript. I cannot figure out how to control the carraige returns for the text. The standard \r\n is not working. Is there another technique I...
2
by: Lee | last post by:
As the subject states, I have been playing in the system trying to figure out a method of using a report as the email body text. So far, the closest I have come is the acFormatHTML. However,...
0
by: DFS | last post by:
Access 2003, Outlook 2003. DoCmd.SendObject acSendNoObject, , , , , , subjectString, bodyString, True When the email opens, the email body is not populated (bodyString is a string variable)....
2
by: William Gower | last post by:
I am creating an email message to be sent from a web page. How do I embed variables like strFirstName, strLastName etc. into the body I would like it to say. Last Name : strLastName ...
0
by: RickVidallon | last post by:
Missing or Truncated Body Text in Email Application - 2 Strange Examples... There is no earthly reason why this is happening! EXAMPLES HERE: http://65.36.227.70/actmailer/ We have a...
1
by: salad | last post by:
I can store in a a hyperlink like this ClickMe#http://www.test.com in Access ClickMe is the display text, http://www.test.com the address. Is it possible, using SendObject, to send this...
2
by: =?Utf-8?B?UGF1bA==?= | last post by:
Hi, I am creating emails dynamically using C# and would like to place a hyperlink in the email body before sending it out. I added the text for what I thought was a hyperlink but the email just...
9
by: Aslam Shah | last post by:
I have a form with 150 checkboxes. Need to send email with the Checked ones usng ASP. But i am unable to figure a simple way to do it. All i can understand is getting their values one by one and...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: 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$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
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...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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,...

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.