Underlining & emboldening e-mail text

  • Thread starter Thread starter Peter Hallett
  • Start date Start date
P

Peter Hallett

I am using the SendObject method to e-mail a series of reports, as follows:-

DoCmd.SendObject acSendReport, stRptName, acFormatSNP, stRecipient, stCC, ,
stSubject, stMessageText

where the variable string elements are passed as parameters. This should
present no difficulties but the job spec. requires the Message Text to be
emboldened and underlined, and I cannot presently see how to do this.
 
Peter,

Unfortunately, that functionally is not available. I went through the same
question about three months ago and hours of searching yielded nothing.

If anyone else has thoughts to the contrary I would love to be wrong on this
one!

PJ
 
That's a pity - but at least it saves me more fruitless time looking for a
solution.

As you say, it would be nice if someone had a nice convenient solution up
their sleeve. Otherwise, getting around the limitation is going to be a bit
difficult. No doubt the same problem will present itself if an attempt is
made to change font size.

Anyhow, many thanks for your help. Even a negative response is better than
none at all but don't you wish that, instead of adding bells and whistles, in
an attempt to hype-up Access 2007, Microsoft had dealt with some of the
numerous shortcomings of 2003?
 
Of course it is possible. Just not using SendObject. Depending on the
environment, and the customers requirements I have used two methods to do
this.

Method 1: Automate Outlook. If the client is using Outlook as an Email
client this is an easy way to go. Have a look here for a place to get
started. http://msdn.microsoft.com/en-us/library/aa159619(office.11).aspx
Outlook supports rich text and Automating it is well understood, and ther
are lots of examples.

Method 2: Use CDO (Collaboration Data Objects) to send rich text email with
attachments. Here is a link to get you started.
http://www.worksrite.com/CDOMail.htm This is also very easy to get going,
and it will send mail straight away without anoying the user with the
Outlook security warning promps.

I have no doubt that there are other methods, but you might want to check
out these two for starters.

Rdub
 
Interesting leads there. Unfortunately, however, the client finds Outlook
particularly inconvenient, largely for the reasons suggested. Access
snapshot also has security features which make it attractive. It is
important that the recipients not be able to edit the e-mails they receive.

On balance, it looks as if circumventing the problem, rather than solving
it, might be the better approach in this case but I am grateful for the
suggestions. They could yet prove useful.
 
OK! Save the Access SnapShot to disk, and then use CDO to create a rich
text email message and attach the file. You could also create a PDF from
your report (using any number of methods) and attach that . Am I missing
something here?

Rdub
 
No, I don't think you are missing anything.

From no solutions I now have at least two, for which I am grateful. There
is nothing more irritating, or embarrassing, than being unable to meet a
client's requirements and it is gratifying to be able to offer a solution.
My task now is to find the one that best meets the job spec.

Thanks for providing some options.
 
Ron,

I am currently implemeting your recommended CDO method. One of its obvious
advantages over SendObject, and one that was not immediately apparent, is the
ability to send multiple attachments. In my original question, I was
concerned with the apparent inability to include emboldening and underlining
in the body of the e-mail, with SendObject but it transpires that the need to
send separate e-mails for each attached file is a more serious impediment.
In contrast, the CDO example, to which you provided a link, seems to be
readily adaptable to send any number of attachments. It all looks fairly
straightforward but I am left with a couple of simple questions to which I
would be grateful for answers.
1. Can I assume that “.CC†can be used to send a copy of the main email?
2. It would be very useful to be able to change font size as well as use
emboldening and underlining in the body of the e-mail. Can I assume that <U>
… </U> will achieve the latter? As to change of font size, can you enlighten
me?

Having now looked at CDO, I have to concede that it looks much more
versatile than SendObject. You will have to forgive me if I was a bit slow
to realise this. ‘Thinking outside the box’ does not always come naturally,
but I am certainly grateful for the information. Barring any major snags, it
looks as if CDO will meet the requirement very nicely.
 
Yup .CC will work as well as .BCC should you need that one too.

You can use almost any HTML tag you need to support rich text. In fact if
you treat the body of the Email message as you would the body a web page you
are on the right track.

<font face='Arial, Helvetica, sans-serif' size='+3' color='#FF0000'>I am Big
and Red</font>
<font face='Arial, Helvetica, sans-serif' size='-1' color='#000000'>I am
Small and Black</font>

Ron W
 
Just a final note on CDO. It works a treat! SendObject may be OK for
sending a single object but, particularly if the e-mail has to include
different formatting commands, and/or multiple attachments are to be
included, then CDO is clearly the thing to use. To anyone initially baulking
at the need to replace one line of code with over half an A4 page of commands
I’d say, “Go ahead. The benefits more than outweigh the additional effort.â€
On top of that, the Works Rite example, to which the link was provided, is a
model of clarity and anyone with even a modest VBA facility should be able to
use it. I have incorporated it into a bigger general-purpose sub-routine
and, after correcting a few silly mistakes of my own, it all ran perfectly.
Nice one Ron! Next time I’ll try to look a bit further ahead.
 
Back
Top