Created
September 15, 2016 18:47
-
-
Save paxperscientiam/ba9c43e02deb513c85c2aaed37d9e213 to your computer and use it in GitHub Desktop.
Exporting UTF-8 WS Data with VBA
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I've posted this on Microsoft Answers and Reddit already, but, for posterity, I'm putting it on Pastebin too. | |
Refer to this paste: http://pastebin.com/US1wuKgH | |
Or, to the StackOverflow post by Robert Knight if it still exists: https://stackoverflow.com/questions/6136798/vba-shell-function-in-office-2011-for-mac | |
Basically, you feed execShell() a script that copies the data from a worksheet and passes it from the clipboard into a newly formed file. The trick, though, is to set the "locale" of the newly spawned shell session. | |
Example VBA code: | |
*** | |
rngSomeRange.copy | |
scriptToRun = "export LC_ALL=en_US.UTF-8 && " & _ | |
"touch " & sOutFolder & "/" & sOutFile & ".tex && " & _ | |
"pbpaste > " & sOutFolder & "/" & sOutFile & ".tex" | |
execShell scriptToRun, exitCode | |
**** | |
You'll have to tweak this a bit for your purposes, but holy shit it works!!!! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment