2
我正在調查將數據從Notes數據庫直接拖入Excel中,因爲我們的財務人員正在手動重新輸入數字a.t.m. 這是我到目前爲止的代碼:從Excel VBA訪問Lotus Notes數據庫 - 如何獲取COLUMNVALUES?
子notesBB()
Const DATABASE = 1247
Dim r As Integer
Dim i As Integer
Dim c As Integer
Dim db As Object
Dim view As Object
Dim Entry As Object
Dim nav As Object
Dim Session As Object 'The notes session
Dim nam As Object
Dim val As Variant
Dim v As Double
Dim items As Object
Set Session = CreateObject("Lotus.NotesSession")
Call Session.Initialize
Set nam = Session.CreateName(Session.UserName)
user = nam.Common
Set db = Session.getdatabase("MSPreston", "Billbook1415.nsf")
Set view = db.GetView("By Month\By Dept")
view.AutoUpdate = False
Set nav = view.CreateViewNav
Set Entry = nav.GetFirst
val = Entry.childcount
val = Entry.ColumnValues(6) ' this doesn't work
Set items = Entry.ColumnValues 'from a suggestion on the net
val = items(6) 'this doesn't work either
MsgBox (val)
End Sub
錯誤是「對象變量或帶塊變量未設置」
惱人的事情是,我可以看到i的值想在ExcelVBA調試窗口中...所以我不能離得很遠。我猜想它如何訪問項目的數組妥善