I use Notepadd++ as a great way to copy text into Excel VBA. However I notice that the underscore character gets converted to strange character



  • odd conversion from Notepad++.png
    This does not happen with notepad?
    Can you tell me how to avoid this problem?
    Regards
    Alfred (Excel1Star)



  • @Alfred-Vachris ,

    It does not happen in Notepad++, either. Notepad++ will copy whatever text is in the Notepad++ window, and when you paste it into the VBA editor, it will paste that same text into VBA.

    The underscores above look correct. You do have comment lines that seem to have a high-codepoint unicode character. But for Notepad++ to have put those in the copy buffer, those characters() must have existed in the Notepad++ editor when you copied them. (: or bytes that looked different in Notepad++ due to encoding settings, but got interpreted by VBA as those characters)

    Did you do something strange, like open a binary file in Notepad++, which happened to have some of the text rendered as text, but other characters as binary characters – if so, then when you copied those bytes and pasted them into VBA, maybe VBA interpreted those bytes as the funny characters, and it had nothing to do with Notepad++.

    But that’s as much guessing as I can do for now. “It works for me” is the only thing I can be sure of. If you provide us enough information to try to replicate your problem, maybe someone who has access to Excel+VBA will be able to help (depending on what time of day and how busy I am at work, I might be able to try a quick experiment).



  • Maybe, the issue is with file encoding?
    91f4fd93-764f-4c12-8edb-c40f67f9cce7-image.png
    Maybe, you need to use a different encoding. Just a guess.


Log in to reply