How to remove ENTER keystroke from collections columns

agroenek

New Member
Hi all,

I have read data from a web page by using Get Table, the data is stored in a collection. I noticed that the columns contain a "enter"keystroke, which I want to remove from the columns

I tried writing VBA code, similar to Remove dots from headers in the object: Collection Manipulation. As I am not familiar with VBA, I do not find this an easy task. And I have not succeeded yet, see images for code snippets.

Another strategy I tried: using an expresssion: Replace([Werktabel.(Kolom)]; Chr(13); ""). The error I am getting here is that the object is not correctly pointed to, in dutch: "De objectverwijzing is niet op een exemplaar van een object ingesteld". Werktabel is a collection with a dynamic number of columns, so I need to loop through all columns.

Any tips/tricks?
 

Attachments

  • Knipsel1.PNG
    26.1 KB · Views: 17
  • Knipsel2.PNG
    8.7 KB · Views: 18

sivagelli

Well-Known Member
Alright! on reading the post again, i noticed Chr(13) which represents newline in ASCII. So, to remove newline character, you can use 'Remove Non Word Characters' action in Utility Strings VBO. This action trims any non-word character and the output will have characters: a-z A-Z 0-9 _ (Yes, an underscore character).

Peek in to the object's action code and explore.
 

VJR

Well-Known Member
Another strategy I tried: using an expresssion: Replace([Werktabel.(Kolom)]; Chr(13); "").
Have you tried using the NewLine() function and replacing it with an empty string? If its truly a newline character it will be replaced.
 

agroenek

New Member
Hi, finally solved. Remove non characters didn't work for us. All characters succeeding the first Chr(13) enter were removed. The attachments shows the code that did the trick for us.
 

Attachments

  • aaaPDF.pdf
    51 KB · Views: 22

sivagelli

Well-Known Member
Thank you, for sharing the code!

I used 'Remove non characters' action and it never let me down! It trims the non-word characters at the beginning or end of the strings but not in-between. So, if you text in a data item: newline newline XYZ newline ABC, on using 'Remove non characters' the text will be trimmed and becomes: XYZ newline ABC. The point is, this action will not replace non-word characters between the text but it will trim on either sides.

Have you tried Replace([col.Field], NewLine(), "") suggested by @VJR?. This should do the trick for you, if you have newline chanracters between the text of your data item.

Post back, trying @VJR suggestion!
 
Last edited:
Top