ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How can I set encoding in EXCEL (https://www.excelbanter.com/excel-programming/286241-how-can-i-set-encoding-excel.html)

Lincy

How can I set encoding in EXCEL
 
My SQL Server 2000 is English version. Traditional Chinese words are
saved in some fields of a table. I used ADO.Recordset to read records
and save them into an EXCEL file. But when I open the EXCEL file, but
the traditional chinese words are unreadable. The following are my
code. I appreciate you kind help.

set objExcel = Server.CreateObject("Excel.Application")
objExcel.Visible = false
objExcel.Workbooks.Open(Server.MapPath("ExportExce l/Export_Template.xlt"))
objExcel.Sheets(1).select
set myWorksheet=objExcel.ActiveWorkbook.ActiveSheet

Rnum = 1
strRange="A"&Rnum&":b"&Rnum
while not rsSel.EOF
myWorksheet.range(strRange).value=array(rsSel("VNa me"),rsSel("VAddress"))
Rnum=Rnum+1
rsSel.MoveNext
wend

jaf

How can I set encoding in EXCEL
 
Hi Lincy,
Don't know. I suspect you need to tell Excel what format the data is in
(unicode, codepage?).

I did notice in your code you are opening a template file.
Is that really what you want, to open the template for editing?

Maybe that should be...
objExcel.Workbooks.Add(Server.MapPath("ExportExcel/Export_Template.xlt"))

No idea if it makes a difference.

--
John

johnf202 at hotmail dot com
"Lincy" wrote in message
om...
My SQL Server 2000 is English version. Traditional Chinese words are
saved in some fields of a table. I used ADO.Recordset to read records
and save them into an EXCEL file. But when I open the EXCEL file, but
the traditional chinese words are unreadable. The following are my
code. I appreciate you kind help.

set objExcel = Server.CreateObject("Excel.Application")
objExcel.Visible = false

objExcel.Workbooks.Open(Server.MapPath("ExportExce l/Export_Template.xlt"))
objExcel.Sheets(1).select
set myWorksheet=objExcel.ActiveWorkbook.ActiveSheet

Rnum = 1
strRange="A"&Rnum&":b"&Rnum
while not rsSel.EOF

myWorksheet.range(strRange).value=array(rsSel("VNa me"),rsSel("VAddress"))
Rnum=Rnum+1
rsSel.MoveNext
wend





All times are GMT +1. The time now is 05:43 PM.

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