Creating an email and setting the line spacing to 1 (1 Viewer)

atrium

Registered User.
Local time
Today, 18:04
Joined
May 13, 2014
Messages
348
I'm trying to use the HTMLBody. I set the font and the font size but I can't seem to set the line spacing.

Code:
 Me.strBody = "Your Text Here"
 .HTMLBody = "<p style='font-family:calibri;font-size:14.5; line-height: 1'>" & Me.strBody & "</p>"
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 03:04
Joined
Feb 28, 2001
Messages
27,303
According to what I've seen, that should work OK. What is the effect that you are seeing that lets you know it isn't working?
 

atrium

Registered User.
Local time
Today, 18:04
Joined
May 13, 2014
Messages
348
When the user types in the area "Your Text Here" it double spaces the lines. The font is fine and the font size is right but not the line spacing
 

MrHans

Registered User
Local time
Today, 10:04
Joined
Jul 27, 2015
Messages
147
Yes, I have the same problem with my HTML styled e-mails. Would be interesting if anyone knows a solution for this...
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 03:04
Joined
Feb 28, 2001
Messages
27,303
Seems to me I just answered something like this.

You'll have to play with it a bit. Try using decimal 1.0, then maybe try fractional height to see what spacing you get.
 

MrHans

Registered User
Local time
Today, 10:04
Joined
Jul 27, 2015
Messages
147
In my case, I generate an email with text, all this has the correct line height, default I guess.
But when you start typing in there, it gets a huge line height 1,5 or maybe even 2.0

I didn't try specifying the line height like above yet. Will try
 

MrHans

Registered User
Local time
Today, 10:04
Joined
Jul 27, 2015
Messages
147
I tested it today, but adding the line height parameter in the HTML code makes no difference. The content is generated correctly, but as soon as you start typing in the email, it starts using a massive line height.
 

isladogs

MVP / VIP
Local time
Today, 09:04
Joined
Jan 14, 2017
Messages
18,258
Hi

I can send HTML email from Access with a line spacing=1.
The trick is to use a non-breaking space (&nbsp).
If you use </P> an extra line is inserted in the text

The HTML below sends an email as in the attached image:

==============================================

strMsg = "<P>Hi " & strForename & "</P>" & _
" <DIV><B><I>" & GetProgramName() & " (" & GetProgramShortName() & ")</B></I> has been updated to version <B><I>" & GetLatestSDAVersion() & "</B></I><DIV>" & _
" <DIV>This contains new features, performance improvements & bug fixes.</DIV>" & _
" <P>However, you are currently using <B><I>" & GetProgramShortName() & "</B></I> version <B><I>" & strVersion & "</B></I> on the computer " & strWorkstation & "." & _
" <DIV>Please open <B><I>" & GetProgramShortName() & "</B></I> using the desktop shortcut  " & _
" <IMG border=0 hspace=0 alt='' src='" & GetCriteria() & "SDA5.png' width=25 align=baseline height=25>" & _
"   so it can be updated:<DIV></P> " & _
" <P><IMG border=0 hspace=0 alt='' src='" & GetSelection() & "SDAUpdater1.gif' align=baseline></P>" & _
" NOTE:<DIV></DIV> If the program fails to update to version <B><I>" & GetLatestSDAVersion() & "</B></I>, please repeat this and click the " & _
"<B><I>Force Update </B></I> button on the updater screen." & _
"<P>=================================================</P>" & _
"This is an automated email sent from <B><I>" & GetProgramName() & "</B></I><DIV>" & _
"Please do NOT reply as this email address is not monitored</DIV></P>"
 

Attachments

  • Capture.PNG
    Capture.PNG
    42.3 KB · Views: 106

isladogs

MVP / VIP
Local time
Today, 09:04
Joined
Jan 14, 2017
Messages
18,258
Just a correction to my previous post.
It should read:
The trick is to use a </DIV> rather than </P> at the end of the line of text

Of course, using   just creates a space

BTW I don't specify the line spacing anywhere in my code for this email
It defaults to line spacing = 1 unless I use </P> at the end of a line of text
 

Users who are viewing this thread

Top Bottom