Adding linebreaks to text

Hello,

I am currently re-developing an old process which sends out emails regarding payment defaults. I am attempting to add line breaks to format the email with “\n”, vbCrLf, “[k(enter)]” and Environment.NewLine. None of these work with Set Text or SimulateType/SendWindowMessages Type Into, and will either type \n in the email body or type a space, instead of a new line. Standard Type Into takes too long.

I copied the same activities over and it seems to work on a VM, but not on my current machine which is where it needs to run from. I have already made a post on the same issue but it is closed and I have already tried everything suggested with no fix.

Does anybody have any other solutions I can try? Any help is appriciated.

Thanks in advance.

Edit: I am typing into a web email with no HMTL options

@william.coulson

If you are typing in the web Email

Use TypeInto and Add the Enter Key from + button

Below for your reference
image

And if you sending through Send activities you can use <br> and make IsBodyHtml checked

Hope this helps you

Thanks

@william.coulson
Is it a fixed email template? If it is you can format it as HTML and enable ‘IsBodyHtml’, assuming you are using Outlook Send Mail.

Hi @ksrinu070184,

I have tried this also, forgot to mention it. It will not work when SimulateType is checked. I cannot use HTML in the web email, and cannot send the emails through send email.

Hi @MichaelL,

It is a fixed template but I need to add a list of months/amounts in the middle of it. The body can be formatted fine, the issue is outputting it

@william.coulson What web email are you using? So that we can test :slight_smile:

@william.coulson

Can’t you remove SimulateType?
OR
I believe you have to place multiple TypeInto’s and Send Hotkeys in middle which is not a good solution

I will get back to you if i found any good solution

Thanks

@william.coulson

Check with below

image

This worked, Hope this helps you

Thanks

Hi @MichaelL,

It’s a salesforce site belonging to a client, so I can’t give access. That’s also why there are no screenshots in my original post.

Hi @ksrinu070184,

The body takes around 1min 30sec to type per email without SimulateType, and there are around 90 emails to send in one run, which will take far too long. I will give vbNewLine a go, but I think it will have the same results as vbCrLf.

@william.coulson

OH Okay, I tried with Gmail and it is working fine, maybe there is something blocking as you are salesforce site

just my 2 cents: typing out the full namespace System.Environment.NewLine helped me when I had this issue before.

I believe vbNewLine will work fine. I’ve used it in Gmail and Outlook web app.

@ksrinu070184 @ManiPrajwal_K,

I tried vbNewLine, it works fine in the message box before the Set Text and adds Line Breaks, but changes the Line Breaks to spaces when the data is entered with Set Text. This is the same as vbCrLf. See screenshot (apologies for the poor scribbling, email contains sensitive information):

@byuli,

I will try System.Environment.NewLine now

Edit: Still the same issue as above, same as vbNewLine and vbCrLf

@william.coulson is it possible to write it in the notepad first and then use send hotkey ctrl+a, ctrl+c and then ctrl+v into the text field?

Not sure if its a good work about.

Hi @MichaelL,

I have tried Writing to notepad then reading it back, which did not work. I will try typing into notepad and copy/pasting.

@william.coulson yap Set Text probably wouldn’t work no matter which source it is coming from. Give it a go

@MichaelL,

The notepad wrote fine, kept the line breaks. But it won’t copy into the email body box.

Edit: Get from clipboard also does not work

I ran the old code again, and it worked. Set the new code up exactly the same and it doesn’t work. The packages are not the same versions, as the old code was made 12 months ago. Could this be the reason why the new version isn’t working?

@william.coulson did you do a click into the text field first? Or click before typing property?

I do not, as I’m using Set Text.

Currently trying to rebuild the process to work on Chrome to see if that helps