>>>Does anyone know of a third-party product that will convert RTF files to TXT format? We really need a program that will run on its own (a batch program) to convert mass quantities of files on a daily basis.
>>>
>>>TIA!
>>
>>Joe,
>>Below code would get a directory where .rtf are stored and write out .txt versions. Pls be notified rtf has a LoadFile method but it can't be used here because it can't accomodate to fast operations - you'd need set step, wait or alike (instead fopen(),TextRTF etc was used).
>>
local lcRTFDir,lnRTFFiles,myRTF, lcSaveFile,lnSize
>>local array arrRTF[1]
>>lcRTFDir = getdir()
>>if empty(lcRTFDir)
>> return
>>endif
>>lnRTFFiles = adir(arrRTF, lcRTFDir+'*.rtf')
>>myRTF = CREATEOBJECT("RICHTEXT.RichTextCtrl.1")
>>for ix=1 to lnRTFFiles
>> lcSaveFile = lcRTFDir+stuff(arrRTF[ix,1],rat('.RTF',arrRTF[ix,1]),len('.rtf'),'.txt')
>> lnHandle=fopen(lcRTFDir+arrRTF[ix,1])
>> lnSize=fseek(lnHandle,0,2)
>> =fseek(lnHandle,0,0)
>> myRTF.TextRTF=fread(lnHandle,lnSize)
>> =fclose(lnHandle)
>> myRTF.SaveFile(lcSaveFile,1)
>>endfor
>>
Cetin
>
>Thanks for the code. I have tried it and am getting an Exception Code saying
>
>OLE IDIPSATCH EXCEPTION CODE 0 FROM RICHTEXTCTRL: PROPERTY CANNOT BE SET.
>
>What is causing this error? or why can't the property be set?
Joe,
MS KB says it's a confirmed bug and was corrected in VS SP5. Would you check your version. It's in system or system32 directory named Richtx32.ocx. Version should read 6.0.88.77
Cetin