Save a .TXT file from Excel via VBA in UTF-8

Regular Visitor

Save a .TXT file from Excel via VBA in this attached file and select / force / hack / default some parameter (anywhere in the system, registry, Excel, VBA, etc.) to control character Encoding to export as utf-8.

 

Device and OS platform:
Intel Core i5-4590 CPU @ 3.3GHz with 8 GB RAM.
Windows 10 Pro 64-bit OS X64-based processor (3-month-old software installation)
Version 2004 (OS build 19041.985)

 

Excel product name and version number:
Microsoft 365: Excel Version 2105 (Build 14026.20246 Click-to-Run)

 

File Example:
http://eaglesvn.com/dev/excel_example.zip

 

Workflow:

1) Open attached XLSM (utf-8 encoded) Template (Excel2GIFT) containing a VBA script that exports a TXT file in Moodle GIFT Format.

2) I then enter data on Sheet1 which populates a multiple-choice quiz template on the GIFT Exporter Sheet via simple cell linking.

3)  I then 'Clear Contents' of empty "Question" Cells and run the VBA Script to export a TXT file.

 

Up to here, there are no problems.

 

However recently, the exported GIFT format TXT file is now encoded using ANSI, thus corrupting the utf-8 based certain Vietnamese characters ANSI doesn't support. I am NOT sure if this issue began after some update. During export, the 'save as' window=>tools does NOT offer the possibility to edit Character Encoding - instead it says 'map network drive...'

 

I've spent a week researching this with little progress on what should be a simple task -

 

Save a .TXT file from Excel via VBA in this attached file and select / force  / hack / default some parameter (anywhere in the system, registry, Excel, VBA, etc.) to control character Encoding to export as utf-8.

 

I submit to the Braintrust of this learned community for a solution...

0 Replies