嗨朋友我對蓮花筆記很陌生,我有一個查詢,我無法解決。不能夠在Lotus Notes中簡單的文本文件
我已經創建了蓮花筆記中的蓮花腳本代理,它使用「查看詳細信息」生成文本文件。
Option Public
Sub Initialize
MsgBox " Agent AccessUserList"
On Error GoTo HandleError
Dim session As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim view As NotesView
Dim embobj As NotesEmbeddedObject
Dim rtitem As NotesRichTextItem
Dim ErrMsg As String
Dim dateTime As New NotesDateTime("")
dateTime.LSLocalTime = Now
UserListDate = dateTime.DateOnly
TheDate=Format(Now(),"mmdd")
filename = CurDrive$()+"\color\"+"Colors_" +TheDate+"Selection_OP" +".txt"
MsgBox filename
Set db = session.CurrentDatabase
On Error GoTo LogErr
Dim v As NotesView
Dim s As New NotesSession
Dim ec As NotesViewEntryCollection
Dim ent As NotesViewEntry
Dim filePath As String, valString As String
Dim myStream As NotesStream
Dim fileNum As Integer, count As Integer, x As Integer
Set myStream = s.Createstream()
Call myStream.Open(filename, "ASCII")
Call myStream.Truncate()
Set db = s.CurrentDatabase
MsgBox "BEFORE ENTER VIEW"
'Call myStream.Writetext(i.Title, 0)
Set v = db.GetView("SelectCustomer")
MsgBox "Entered View"
If (v Is Nothing) Then
MsgBox "View does not exist"
Exit Sub
End If
count = v.Columncount
ForAll i In v.Columns
If i.Position = count Then
Call myStream.Writetext(i.Title, 0)
Else
Call myStream.Writetext(i.Title & "||")
End If
End ForAll
MsgBox "AFTER COLUMN"
Set ec = v.Allentries
Set ent = ec.Getfirstentry()
While Not ent Is Nothing
x = 1
ForAll j In ent.Columnvalues
If IsArray(j) Then
valString = |"| & Join(j, ",") & |"|
Else
If InStr(j, ",") > 0 Then
valString = |"| & j & |"|
Else
valString = j
End If
End If
If x = count Then
Call myStream.Writetext(valString, 0)
Else
Call myStream.Writetext(valString & "||")
End If
x=x+1
End ForAll
Set ent = ec.Getnextentry(ent)
Wend
closeFile:
Call myStream.Close()
Exit Sub
HandleError:
MsgBox "Error - " & Error &" at line number " & Erl
Exit Sub
LogErr:
Resume closeFile
Exit Sub
End Sub
這是上面的代碼,它在服務器中生成具有細節的文件。
但我想只有當我開始在特定的文件夾科龍我試圖刪除所有不必要的代碼,但如果我評論的任何代碼,我不會得到錯誤,但該文件將永遠不會得到它每天產生的空文件產生。
*誰能幫助我編輯的代碼,我需要生成簡單的空文本文件日常所有的線我應該在這個代碼*
感謝您的時間和幫助編輯。
我有你想要什麼不知道......如果你想要一個空文件,那麼你需要這些四行代碼(分號是行分隔符),'設置myStream = s.Createstream();調用myStream.Open(filename,「ASCII」);調用myStream.Truncate();調用myStream.Close()' –
#Torsten是你讓我正確我需要一個通過代理服務器創建一個空文件,但如果我運行代碼我得到錯誤,因爲錯誤-Variant不包含行號爲10的對象 –
但有一點是,代理正在被觸發而沒有錯誤,但文件未在服務器中創建。遠程服務器中特定文件夾的時間更改,但文件夾爲空。沒有創建文件#Emmanuel @TorstenLink –