0

There is some code which copy values, open Notepad, paste there values and coped valies again paste it in Excel. Problem that it paste and the is still as Unicode Text, I need unfomatted text. Is someone had similar problem or know how to paste it as unformatted text? Manually there is option in PasteSpecial section to choose Text.

planas.Sheets("Buy").Range("D3:I26").Copy '1B
'// Start Notepad with focus
Shell "notepad.exe", vbNormalFocus

'// Send the standard CTRL+V. Pastes to the
SendKeys "^V"

'// Send the standard CTRL+A. Mark all values
SendKeys ("^a")

'// Copy from Notepad
SendKeys ("^c")

'// Paste to Excel
sablonas.Sheets(1).Range("B10").PasteSpecial xlPasteValues
Dominique
  • 16,450
  • 15
  • 56
  • 112
  • 3
    Isn't Unicode Text the same as unformatted text? Unicode isn't a format. – Pᴇʜ Feb 11 '19 at 15:12
  • What characters are you getting and what would you want them to be instead? Notepad is running in windows which is UTF-16LE by default (Since Windows NT I think), which is unicode. It sounds instead like you may want to replace certain unicode characters with an ascii alternative? Or perhaps hit it with the a hammer with the `StrConv()` function? – JNevill Feb 11 '19 at 15:18
  • Why go through Notepad? Transfer the values from one cell to another: `sablonas.Sheets(1).Range("B10").value = planas.Sheets("Buy").Range("D3").value` – cybernetic.nomad Feb 11 '19 at 15:24
  • just write it to a text file directly, instead of trying to use copy paste. (i.e. https://stackoverflow.com/questions/11503174/how-to-create-and-write-to-a-txt-file-using-vba ) – AlexT82 Feb 11 '19 at 17:03
  • The problem that then we upload that excel to certain system and it get error, because few numbers have more than 1 digit after comma ((I see it when extract file with ZIP). And that system is not allowed more than one. We copied numbers to Notepad and back and worked so trying to automate it, but maybe there is simplier way to do it. Thanks – Vytautas Lukošiūnas Feb 12 '19 at 06:22

0 Answers0