gilescardew
New Member
- Joined
- Jul 21, 2011
- Messages
- 2
Hi,
I need some help as I am stuck. I had this working before but I can't remember what I did to solve it.
What I have is an excel sheet that contains either Hebrew or Russian characters and I have some VBA that loops through each row and then prints the output into a file that has been opened.
For the Hebrew and Russian it just prints ?????? rather than the actual characters.
So my code does something like
strFilePath = "C:\"
strFileName = "agents.1.xml"
strFile = strFilePath & strFileName
intFile = FreeFile()
'create the text file
Open strFile For Output As intFile
Print #intFile, "<?xml version=" & Chr(34) & "1.0" & Chr(34) & " encoding=" & Chr(34) & "windows-1252" & Chr(34) & "?>"
Print #intFile, "<AGENTLIST>"
With Sheets("New Import Agent")
Do Until .Cells(intRowCount, 4) = ""
'Read data from sheet
Fname = .Cells(intRowCount, 4)
Lname = .Cells(intRowCount, 5)
Print #intFile, "<LASTNAME>" & Lname & "</LASTNAME><FIRSTNAME>" & Fname & "</FIRSTNAME><NAMESUFFIX></NAMESUFFIX>"
The Fname and Lname contain the Hebrew and Russian but when I look at the resultant XML it looks like this
<?xml version="1.0" encoding="windows-1252"?>
<AGENTLIST>
<NEWAGENT>
<LASTNAME>?????</LASTNAME><FIRSTNAME>????????</FIRSTNAME><NAMESUFFIX></NAMESUFFIX>
Any ideas as to print the correct characters.
Thanks,
Giles
I need some help as I am stuck. I had this working before but I can't remember what I did to solve it.
What I have is an excel sheet that contains either Hebrew or Russian characters and I have some VBA that loops through each row and then prints the output into a file that has been opened.
For the Hebrew and Russian it just prints ?????? rather than the actual characters.
So my code does something like
strFilePath = "C:\"
strFileName = "agents.1.xml"
strFile = strFilePath & strFileName
intFile = FreeFile()
'create the text file
Open strFile For Output As intFile
Print #intFile, "<?xml version=" & Chr(34) & "1.0" & Chr(34) & " encoding=" & Chr(34) & "windows-1252" & Chr(34) & "?>"
Print #intFile, "<AGENTLIST>"
With Sheets("New Import Agent")
Do Until .Cells(intRowCount, 4) = ""
'Read data from sheet
Fname = .Cells(intRowCount, 4)
Lname = .Cells(intRowCount, 5)
Print #intFile, "<LASTNAME>" & Lname & "</LASTNAME><FIRSTNAME>" & Fname & "</FIRSTNAME><NAMESUFFIX></NAMESUFFIX>"
The Fname and Lname contain the Hebrew and Russian but when I look at the resultant XML it looks like this
<?xml version="1.0" encoding="windows-1252"?>
<AGENTLIST>
<NEWAGENT>
<LASTNAME>?????</LASTNAME><FIRSTNAME>????????</FIRSTNAME><NAMESUFFIX></NAMESUFFIX>
Any ideas as to print the correct characters.
Thanks,
Giles