View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Wei-Dong Xu [MSFT] Wei-Dong Xu [MSFT] is offline
external usenet poster
 
Posts: 120
Default A macro to export a sheet as UTF8 encoded Unicode file

Hi Dario,

Thank you for replying!

From my understanding to your issue now, the most tough thing is the bitwise operration. I introduce the detail for you.

For hex, you can use hex() to change one decimal value to hex value, for example Hex function will return a string representing the hexadecimal
value of a number.

The same function of & and | from c/c++ in VBA is "and" and "or". You can write one code like:
msgbox (4 and 2)
The result is: 0.

For your issue, you need to bitwise the byte of the value from Excel cell. You can use the code below to read the unicode value of Excel cell to
byte array.

' Code begin

Dim oByteArray() as byte
oByteArray = Application.ActiveSheet.Cells(rowNumber, colNumber).value

' Code end

Then you can check the result byte array in the watch window of VBA. With this byte array, you can compare the value and transfer the them
into UTF-8. After that, FileSystemObject will help you to save the result to one text file.

Please feel free to let me know if you have any further questions.

Does this answer your question? Thank you for using Microsoft NewsGroup!

Wei-Dong Xu
Microsoft Product Support Services
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.