|
|
发表于 2005/1/25 18:03:14
|
显示全部楼层
我也试过这段代码,但我改了下,我用的是本地的服务器,数据库文件是hu.nsf,在数据库里建了一个表单(包括一些域名),还建了一个视图,并且保存了几个文档,是可以了.但是现在我还不知道怎样用vba编程实习把数据库里的多媒体下载下来保存在磁盘的某个路径下,请教大侠们.
Private Sub Form_Load()
Dim session As New Domino.NotesSession
Dim PublicNotesDb As New Domino.NotesDatabase
Dim view As NotesView
Dim C As New NotesViewColumn
Dim Mycount As Integer
Dim i As Integer
Dim j As Integer
Dim viewname As String
session.Initialize
Set PublicNotesDb = session.GetDatabase("", "hu.nsf") '''本地数据库为空即可,hu.nsf库文件
If PublicNotesDb Is Nothing Then
MsgBox ("不能打开Notes库,请查看系统设置!")
End If
viewname = InputBox("Name of view") ''''输入你在数据库建的视图名称
Set view = PublicNotesDb.GetView(viewname)
With grdDataGrid
.Clear
.ColWidth(0) = 300
.Cols = view.ColumnCount + 1
For i = 1 To view.ColumnCount
Set C = view.GetColumn(i)
' .AddItem (C.Title)
.TextMatrix(0, i) = C.Title
j = j + 1
Next
.ColWidth(2) = 1800
.ColWidth(3) = 1800
Dim doc As NotesDocument
Set doc = view.GetFirstDocument
.Row = 1
j = 1
Dim Str As String
Do Until doc Is Nothing
.Col = 1
.Text = doc.GetItemValue("filenumberinbox")(0) ''''filenumberinbox是我建的表单的域名之一
.Col = 2
Str = doc.GetItemValue("head")(0) '''''同上
.Text = Str
.Col = 3
.Text = doc.GetItemValue("classnumber")(0) '''同上
.Col = 4
.Text = doc.GetItemValue("filenum")(0) '''' 同上
Set doc = view.GetNextDocument(doc)
If Not doc Is Nothing Then
If j >= .Rows Then
.Rows = j + 1
End If
.Row = j
j = j + 1
End If
Loop
End With
End Sub
主要功能是实现在msflexgrid控件中显示数据库中各文档的内容,当然必须保证数据库里有文档,不然调不通. |
|