views:

32

answers:

2

So I have a view (object name is 'view') in a Lotus Domino db from which I want to grab the column names and put them in an array:

Dim view As Domino.NotesView
Set view = db.GetView(viewScen)   

//viewScen is a string containing the actual view's name
//db is a string containing the actual db name

These declarations work fine, but when I try to assign those values to an array using the method called 'getColumnNames', the VBA editor tells me that the method is not supported for that object:

Dim someArray() As String

//I tried both of the following with no sucess...

someArray = view.getColumnNames 

someArray() = view.getColumnNames 

What am I doing wrong?

A: 

I think you can do a For..Each with columns

dim idx as integer
dim OneCol as Column

redim someArray(view.Columns.Count)

For idx = 0 to view.Columns.Count - 1
    someArray(idx) = view.Columns(idx).name
Next
Raj More
A: 

According to the 8.0 help files, the getColumnNames method is not supported in COM/OLE. However, the attribute ColumnNames is supported. This is VB code from the Help file:

Private Sub ViewColumnNames_Click()
  Dim s As New NotesSession
  s.Initialize
  Dim dir As NotesDbDirectory
  Dim db As NotesDatabase
  Dim v As NotesView
  Dim cns As String
  Set dir = s.GetDbDirectory("")
  Set db = dir.OpenDatabase("Web test")
  Set v = db.GetView("Main View")
  For Each cn In v.ColumnNames
    cns = cns + cn + Chr(10)
  Next
  MsgBox cns, , "Columns in Main View"
End Sub
Ed Schembor