EXCEL 2016 - VBS macro - problem when pasting text including tabulation character (win10)

DELPORTE Laurent 1 Reputation point
2022-09-22T06:48:30.417+00:00

Hello,

I've to paste text that include the tabulation character from clipboard to EXCEL using a VB script.

If I use .Paste method before using any .TextToColumns method, all is OK : the text is pasted in several columns following the tab character.

But, if, previously, I used a .TextToColumns method (contained in another script), It's going wrong : when I paste the clipboard content, it is displayed in one column and the tab character are converted to spaces.
Note that if I paste the clipboard in a text editor, the tab characters are still present...

So, I have to close EXCEL and start again to make my script running well...

How to avoid the conversion of tab character in spaces when pasting text from clipboard ?

Thanks in advance.

Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,532 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Olaf Helper 41,006 Reputation points
    2022-09-22T06:55:49.377+00:00

    the tab character are converted to spaces.

    That's the default behaviour of Excel, when you are in cell entering mode. Press ESC key to return from that mode.