Dim session As New NotesSession
Dim uiWs As New NotesUIWorkspace
Dim uiDoc As NotesUIDocument
Dim db As NotesDatabase
Dim serverName, dbName As String
Dim formDataType As NotesForm
Dim msgFormVar As Variant
Dim msgForms List As String
Dim msgArray() As String
Dim formNameln As Variant
Dim fieldCount As Integer
Dim msgString As String
formCount = 0
msgString = ""
Set uiDoc = uiWs.CurrentDocument
serverName = uiDoc.FieldGetText("fldServername")
dbName = uiDoc.FieldGetText("fldDatabasename")
Msgbox serverName & dbName,,"DB details"
Set db = session.GetDatabase(serverName,dbName)
If db.IsOpen Then
Print( "Succesfully opened " & db.Title )
Else
Messagebox "Please select the database", , "Database not
selected"
Exit Sub
End If
Forall form In db.Forms
formCount = formCount + 1
msgString = msgString & Chr(10) & " "
& form.Name
'Msgbox formCount
msgForms(formCount) = form.Name
msgFormVar= msgForms
End Forall
Messagebox "This database has " & formCount & "
forms:" & msgString
Redim msgArray(formCount)
'Msgbox msgFormVar
For i =1 To formCount
msgArray(i) = msgFormVar(i)
Next
'
Msgbox Ubound(msgArray)
'Exit Sub
'------------------------------------
'formNameIn = Lcase(Inputbox("Name of form?"))
formNameln = uiWs.Prompt (PROMPT_OKCANCELCOMBO, "Select a form",
"Select a form to open.",
msgArray(1),msgArray)
If Isempty (Trim(formNameln)) Then
Messagebox "Canceled", , "Form not selected"
Exit Sub
End If
If Trim(formNameln)="" Then
Messagebox "Canceled", , "Form not selected"
Exit Sub
End If
Dim ObjExcel As Variant 'Excel Object
Set ObjExcel = CreateObject("Excel.Application")
ObjExcel.Visible = True 'make sure the Excel sheet is visible
Call ObjExcel.Workbooks.add 'to create new worksheet
Set formDataType = db.GetForm(formNameln)
Forall form In db.Forms
If Lcase(form.Name) = Lcase(formNameln) Then
If Isempty(form.Fields) Then
Messagebox form.Name & " has no fields"
Else
fieldCount = 0
msgString = ""
i=2
Forall field In form.Fields
fieldCount = fieldCount + 1
Select Case formDataType.GetFieldType(field)
Case AUTHORS : fieldType = "Authors"
Case DATETIMES : fieldType = "DateTime"
Case NAMES : fieldType = "Names"
Case NUMBERS : filedType = "Number"
Case READERS : fieldType = "Readers"
Case RICHTEXT : fieldType = "Rich text"
Case TEXT : fieldType = "Text"
Case Else
fieldType = "Other " & formDataType.GetFieldType(field)
End Select
msgString = msgString & Chr(10) &
" " & field &" -
"& fieldType
ObjExcel.Cells(1,1).value="Field Type"
ObjExcel.Cells(1,2).value="Field Type"
ObjExcel.Cells(i,1).value=field
ObjExcel.Cells(i,2).value=fieldType
'ObjExcel.Cells(i,3).value=doc.LastModified
i=i+1
End Forall
'ObjExcel.Visible = False
'Messagebox form.Name & " has " &
fieldCount & " field(s):" & Chr(10)
& msgString
End If
Comments
Post a Comment