Text align to the right

Hello everyone

I have a VBA code for sending an Excel sheet as a PDF.

To the file I add text.

I have a problem with the text because I need it to be on the right (Hebrew language).

After an extensive search on the Internet I did not find a solution.

I would appreciate your help,

Kobi

That's part of the code:

SendTo = ActiveSheet.Cells(3, 3)

    If FileName <> "" Then
        RDB_Mail_PDF_Outlook FileNamePDF:=FileName, _
                             StrTo:=ActiveSheet.Cells(47, 3), _
                             StrCC:="", _
                             StrBCC:="", _
                             StrSubject:="שכר עידוד", _
                             Signature:=True, _
                             Send:=False, _
                             StrBody:="<H3><B>...לכבוד</B></H3><br>" & SendTo & _
                                      "<body>מצורף דוח שכר עידוד לעיונך" & _
                                      "<br><br>" & "בברכה תחום שכר עידוד</body>"
15doc1.docx (267.63 KB)

Hello kobibh2

For each paragraph, use this sentense instead of <br>

Don't forget to terminate with </p>

<p align="right">This is some text in a paragraph.</p>

Hope this will help you.

HII Steelson,

first TY

Unfortunately I was unable to complete what you recommended (I only succeeded on the title).

I would be happy if you could fix it.

StrBody:="<H3><B> in honor of </B></H3><br>" & SendTo & _

"<body>TEXT TEXT TEXT TEXT " & _

"<br><br>" & "End of TEXT </body>"

SendTo a variable

Try this

StrBody:="<H3  align="right"><B> in honor of </B></H3><p  align=""right"">" & SendTo & "</p>" _
"<p  align=""right"">TEXT TEXT TEXT TEXT " & "</p>" _
"<p  align=""right"">" & "End of TEXT </p>"

If it doesn't work, please join a light copy of your excel file.

good morning Steelson and else

I join a file

be attention that the first row align to the right,

and the "SendTo" variable need to be in the same row

The name of the macro :"RDB_Worksheet_Or_Worksheets_To_PDF_And_Create_Mail"

The relevant line of code is in line 59

TY again

For me, with light changes ...

                            StrBody:="<H3 align= right><B>in honor of</B></H3><p align= right>" & SendTo & </p> _
                                      "<body align= right>TEXT TEXT TEXT TEXT " & _
                                      "<br><br>" & "End of TEXT</body>"

works well

Nevertheless I have not an hebrew keyboard to test completely.

unfortunately the code not compile.

can you add the file that you work on

Sorry, i add </p> at the last time with a mistake !!

This is the result

two things:

The first, variable "sendTo" goes down a line, it should be in the first row.

Second, except for the first line the rest of the text is still on the left.

Begins to despair.

Attached print screen

Thank you

9prtsc-mail.docx (218.97 KB)

May be it depends on your web browser or mail application.

So try this

                             StrBody:="<H3 align= right><B>in honor of " & SendTo & "</B></H3>" & _
                                      "<p align= right>TEXT TEXT TEXT TEXT </p>" & _
                                      "<br/><p align= right>End of TEXT</p>"

I have been faced the same excel issue. I could not text align to the right in my excel sheet. I got the solution when I change my code. But I have been faced another excel problem because sometimes

. So excel users also got the error.

Welcome enerkey !

Is it possible to get your excel file, if possible a simplified one that show the problem you encountered ?

Search for threads similar to "text align right"