Excel to whatsapp message (With new line in text)

prince
2StarLounger
Posts: 171
Joined: 02 Mar 2015, 17:00

Excel to whatsapp message (With new line in text)

Post by prince »

Hello Sir/Madam, I have an excel sheet that connects with the WhatsApp web. But the problem is I need a new line in the message that is not reflecting on Whatsapp message. I have 100+ records and each record has 10+ new lines. Kindly suggest to me the best way to do this.
Copy enclosed

Thanks & regards,
Prince
Last edited by prince on 22 Apr 2022, 06:24, edited 1 time in total.

User avatar
HansV
Administrator
Posts: 78236
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Excel to whatsapp message (With new line in text)

Post by HansV »

I cannot test this; does it help if you use

Code: Select all

    Message = Replace(Sheet1.Cells(rowno, 2).Value, vbLf, vbCrLf)
    Amount = Replace(Sheet1.Cells(rowno, 3).Value, vbLf, vbCrLf)
or

Code: Select all

    Message = Replace(Sheet1.Cells(rowno, 2).Value, vbLf, "%0a")
    Amount = Replace(Sheet1.Cells(rowno, 3).Value, vbLf, "%0a")
Best wishes,
Hans

prince
2StarLounger
Posts: 171
Joined: 02 Mar 2015, 17:00

Re: Excel to whatsapp message (With new line in text)

Post by prince »

It's working. Thank you so much for your kind support. Really you are a great man.

prince
2StarLounger
Posts: 171
Joined: 02 Mar 2015, 17:00

Re: Excel to whatsapp message (With new line in text)

Post by prince »

Sir, Is this possible to use the same font & alignment (eg. center) of excel can be used on WhatsApp?

User avatar
HansV
Administrator
Posts: 78236
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Excel to whatsapp message (With new line in text)

Post by HansV »

Which of my suggestions worked? The first one or the second one?
Best wishes,
Hans

prince
2StarLounger
Posts: 171
Joined: 02 Mar 2015, 17:00

Re: Excel to whatsapp message (With new line in text)

Post by prince »

second worked.

prince
2StarLounger
Posts: 171
Joined: 02 Mar 2015, 17:00

Re: Excel to whatsapp message (With new line in text)

Post by prince »

Sir, Is this possible to use the same font & alignment (eg. center align and font algerian) of excel that can be used on WhatsApp?

User avatar
HansV
Administrator
Posts: 78236
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Excel to whatsapp message (With new line in text)

Post by HansV »

As far as I know, WhatsApp doesn't support that. You may be able to make text bold, italic or strikethrough, but not to change the font and alignment
Best wishes,
Hans

User avatar
StuartR
Administrator
Posts: 12577
Joined: 16 Jan 2010, 15:49
Location: London, Europe

Re: Excel to whatsapp message (With new line in text)

Post by StuartR »

I don't think WhatsApp supports any text formatting at all. You could paste the text as an image, using text formatted in some other application, but that's about it
StuartR


User avatar
Leif
Administrator
Posts: 7193
Joined: 15 Jan 2010, 22:52
Location: Middle of England

Re: Excel to whatsapp message (With new line in text)

Post by Leif »

As far as I am aware, the only formatting that WhatsApp accepts can be found at WhatsApp Help Center - How to format your messages

In summary:

Italic: To italicize your message, place an underscore on both sides of the text:
_text_

Bold: To bold your message, place an asterisk on both sides of the text:
*text*

Strikethrough: To strikethrough your message, place a tilde on both sides of the text:
~text~

Monospace: To monospace your message, place three backticks on both sides of the text:
```text```
Leif

User avatar
StuartR
Administrator
Posts: 12577
Joined: 16 Jan 2010, 15:49
Location: London, Europe

Re: Excel to whatsapp message (With new line in text)

Post by StuartR »

I never knew that, thank you Leif
StuartR


User avatar
Leif
Administrator
Posts: 7193
Joined: 15 Jan 2010, 22:52
Location: Middle of England

Re: Excel to whatsapp message (With new line in text)

Post by Leif »

StuartR wrote:
10 Jun 2021, 09:06
I never knew that, thank you Leif
On my Android, formatting occurs 'live' as you type, and so you can preview it before sending. On the WhatsApp on my W7 machine, you don't get to see the formatting until you have sent the message.
Leif

User avatar
HansV
Administrator
Posts: 78236
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Excel to whatsapp message (With new line in text)

Post by HansV »

Also in WhatsApp for Android, tap and hold on a word in your message, and a context menu should pop up with Bold, Italic etc.
Best wishes,
Hans

prince
2StarLounger
Posts: 171
Joined: 02 Mar 2015, 17:00

Re: Excel to whatsapp message (With new line in text)

Post by prince »

Thank you for the wonderful suggestions. I will use the same.

prince
2StarLounger
Posts: 171
Joined: 02 Mar 2015, 17:00

Re: Excel to whatsapp message (With new line in text)

Post by prince »

Why not Whatsapp is supporting the full custom message of excel after trigger SEND button?
Copy enclosed.

Thanks and regards
Prince
Last edited by prince on 22 Apr 2022, 06:24, edited 1 time in total.

User avatar
HansV
Administrator
Posts: 78236
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Excel to whatsapp message (With new line in text)

Post by HansV »

I'm afraid it is not possible for me to test the code. Sorry!
Best wishes,
Hans

prince
2StarLounger
Posts: 171
Joined: 02 Mar 2015, 17:00

Re: Excel to whatsapp message (With new line in text)

Post by prince »

Thank you for your quick response sir. Luckily, I found the mistake. The code is correct. It was a special character (&) mistake that not supported by whatsapp in a simple text.
Thank you for the quick support.
With regards
Prince

User avatar
HansV
Administrator
Posts: 78236
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Excel to whatsapp message (With new line in text)

Post by HansV »

Glad you found it!
Best wishes,
Hans

yasserali6633
NewLounger
Posts: 1
Joined: 01 Jan 2022, 16:10

Re: Excel to whatsapp message (With new line in text)

Post by yasserali6633 »

Help with the following code please:

textmessage = Replace(Sheets(1).Range("Q" & i).Value, vbLf, **NEW LINE**)

All of my codes are working perfectly fine and this part of the code which I am using to send messages from excel to whatsapp. The problem is, the message doesn't go in one whole chunk but in seperate line breaks, which doesn't look good. So I am trying to replace the vbLf with something that will help me to send the message as a whole. So what should I write after coma, in the asterik part to create line breaks? I tried %0a, vbCrLf, vblf.

Nothing works. I tried to use application.sendkeys ("+{ENTER}") also ("+~") also ("^~") also ("^{ENTER}"), i think one of these might work but I don't know how to code within the replace function.

Or may be if you have any other solution, please help. Thank you

User avatar
HansV
Administrator
Posts: 78236
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Excel to whatsapp message (With new line in text)

Post by HansV »

Welcome to Eileen's Lounge!

Using "%0a" worked for the original poster in this thread, I don't know why it doesn't work for you. It might be easier to replace vbLf with a space " ".

SendKeys won't help, this is used to send commands to an application; it won't work to replace characters in a text string.
Best wishes,
Hans