'//export to text
Function CM_exportToTxt() As Integer
'//匯出txt檔
On Error Goto errorhandler
Call jmcf_SetNewVars()
'
CM_exportToTxt = True
Dim col As NotesDocumentCollection
Dim doc As NotesDocument
Dim i As Integer, sFileNm As String
Set col = jmcdb.UnprocessedDocuments
Dim txt As String
Dim fileNum As Integer
Dim counter As Integer
' Get an unused file number so LotusScript can open a file.
fileNum% = Freefile()
counter% = 0
sFileNm = "D:\tmp\temp" + Format(Now(), "yyyymmddhhmmss") + ".txt"
'Open "D:\tmp\temp.txt" For Output As fileNum
Open sFileNm For Output As fileNum
Do While Not Eof(fileNum%)
' Read each line of the file.
Line Input #fileNum%, txt$
' Increment the line count.
counter% = counter% + 1
Loop
Seek fileNum%, 1
For i = 1 To col.Count
Set doc = col.GetNthDocument(i)
'//"2010049P" "A2086M_12_90HV"
Print #fileNum, Chr(34) + doc.SerialNumber(0) + Chr(34) + Chr(9) + Chr(34) + doc.PartNo(0) + Chr(34)
Next
Close fileNum%
If CM_exportToTxt Then
Messagebox "export ok!", 0, "attention"
End If
TheEnd:
Exit Function
ErrorHandler:
CM_exportToTxt = False
Print "lib: CM.ReferenceAction4BA: CM_exportToTxt error line = " + Cstr(Erl) + ", error = " + Error$
Resume TheEnd
End Function
沒有留言:
張貼留言