ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro to Print Text to file in UTF-8 (https://www.excelbanter.com/excel-programming/429939-macro-print-text-file-utf-8-a.html)

jakeatkins via OfficeKB.com

Macro to Print Text to file in UTF-8
 
Hello,

I am trying to print the value of a cell in Excel to a file "temp.html". The
button's macro looks like this:

Sub Text()
Dim i As Long
Open "c:\temp\Homepage.html" For Output As #1
For i = 1 To Selection.Cells.Count
Print #1, Selection.Cells(i).Value
Next i
Close 1
End Sub

I need to know what to add to this code so that the file is created as UTF-8
encoding. I am trying to preserve foreign characters, and currently they are
all being saved as "???????????".

Thanks!

--
Message posted via http://www.officekb.com



All times are GMT +1. The time now is 11:28 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com