View Single Post
  #12   Report Post  
Posted to microsoft.public.excel.programming
NickHK NickHK is offline
external usenet poster
 
Posts: 4,391
Default The Print # command print not all rows from excel sheet to file

This line :
Print #OutFile, Replace(Input(LOF(InFile), #InFile), "1LS-Arial",
"1LS-OCR-B-10 BT")

needs to be all one line. The news reader wrapped it.

NickHK

"NickHK" wrote in message
...
I can't repeat your error(s) using this code your XML file.
It replaces fine, no Chinese or errors.

Dim InFile As Long
Dim OutFile As Long

InFile = FreeFile
Open "C:\Replace.txt" For Input As #InFile

OutFile = FreeFile
Open "C:\outdat.txt" For Output As #OutFile

Print #OutFile, Replace(Input(LOF(InFile), #InFile), "1LS-Arial",
"1LS-OCR-B-10 BT")

Close #InFile
Close #OutFile

As for the files, whilst they may be text, they can still be saved in a
Unicode format. Open in NotePad, do a SaveAs and check the Encoding

setting.
However, I get different errors to those you mentioned if the file is
Unicode.

NickHK

"pieros" wrote in message
oups.com...
Good morning NickHK (It now is here about 08:40 am),

My text files are good readable characters. Here is an example:

<?xml version="1.0"?
<DynaMark-Project title="Sjabloon_40mm_Rb.xml" version="0.1"
<Dynamark-Object type="CObjText"
<CObjBaseData template-version="0.1"
<ObjName type="CString"ExpDate</ObjName
<ParamDelaysName type="CString"KM09standaard</ParamDelaysName
<Invers type="bool" value="false"/
<Mark type="bool" value="true"/
<Offset type="CPoint" value="-1908788 -725252"/
<ScaleX type="double" value="1.8"/
<ScaleY type="double" value="2.2"/
<RadiantX type="double" value="-1.5708"/
<RadiantY type="double" value="-1.5708"/
<MirrorX type="bool" value="true"/
<MirrorY type="bool" value="true"/
<LaserNr type="int" value="0"/
<MinVectorLength type="double" value="0"/
<XCenterMode type="int" value="0"/
<YCenterMode type="int" value="0"/</CObjBaseData
<CObjText
<Text type="CString"2222222</Text
<FontName type="CString"1LS-Arial</FontName

And than about 100 - 120 lines for each file.
So there seems nothing wrong with the text.

My goal is to replace the text 1LS-Arial or 1LS-Arial-U in 1LS-OCR-B-10
BT in each file but in some files the text 1LS-OCR-B-10 BT is already
present so needs no modification.

Pieros.