I created a Lotusscript to import large amounts of text from a CSV file into a RT field. When opening some documents, I get the error above. I think that the field “casenotes” is too in some of the exported records, which causes the hiccup. Can someone please point me to an example script that takes a very large text block and splits it into multiple fields? Or is there a better way to handle this one? Here is the script:
Sub Initialize
Dim ticket As String, company As String, group As String, occurred As String, LastModified As String, Individual As String, TicketStatus As String
Dim Details As Variant, Notes As Variant, Resolution As Variant
Dim bigblob As Variant
Dim length As Long
Dim start As Long
Dim nextpos As String
Dim position As Long
Dim WhereWeAre As Long
Dim EndPos As Variant
Dim fields(10) As Variant
Dim fieldlength As Long
Dim session As New NotesSession
Dim db As notesdatabase
Dim doc As NotesDocument
Set db = session.currentdatabase
nextpos = ""","""
EndPos = Chr(10) & Chr(13)
filenum%=Freefile()
writefile%=filenum%+1
Open "c:\my documents\export queries\ closed tickets.csv" For Input As filenum%
REM Open “c:\test.csv” For Append As writefile%
Do While Not Eof(filenum%)
Line Input #filenum%, bigblob
length = Len (bigblob)
start = 1
position=0
fieldlength=0
For i= 1 To 9
start=start +fieldlength+1
position = Instr(start, bigblob,nextpos)
fieldlength=position-start
fields(i) = Mid$(bigblob, start, fieldlength)
start=start+2
Next
start=start +fieldlength+1
length=length-start
fields(i) = Mid$(bigblob,start,length)
Set doc = db.CreateDocument
doc.Form = "Remedy Case"
doc.ticket=fields(1)
doc.company=fields(2)
doc.group=fields(3)
doc.individual=fields(4)
doc.occurred=fields(5)
doc.last_modified=fields(6)
doc.details=fields(7)
doc.casenotes=fields(8)
doc.resolution=fields(9)
doc.TicketStatus=fields(10)
Call doc.Save( False, False )
REM Write #writefile%, bigblob
Loop
Close filenum%
Close writefile%
End Sub