Printing Hebrew and Russian to file

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
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
It could be that the pc you're viewing the xml file from doesn't have the required language packs installed.

Try browsing to a Russian or Hebrew website to confirm or deny this.
 
Upvote 0
thanks for the reply.

When I F8 through the code and get to the Fname and Lname variables they show as question marks so I don't think the problem is with the XML itself, it seems to be that the VBA just doesn't understand the characters
 
Upvote 0

Similar threads

Forum statistics

Threads
1,224,551
Messages
6,179,473
Members
452,915
Latest member
hannnahheileen

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top