Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ' Requires that LotusNotes Item/Field names are entered across the first row in a sheet
- ' E.g. Try adding Title, Status, Initiator on the first row
- ' Fills out values based on criteria entered in "SearchString" - currently set to "Author is me"
- Sub GetDocProps()
- Set Session = CreateObject("Lotus.NotesSession") 'Start a session to notes
- strPass = ""
- Call Session.Initialize(strPass)
- strSrv = ""
- strDb = ""
- Set Db = Session.GETDATABASE(strSrv, strDb)
- ' Get this string by right clicking in a document form once it is opened
- SearchString = "@Contains(@Author;" & Chr(34) & Application.UserName & Chr(34) & ")"
- Set dtime = Session.CREATEDATETIME("01/08/2019 00:00:01 AM")
- Set Docs = Db.Search(SearchString, dtime, 0)
- Set Doc = Docs.GETFIRSTDOCUMENT
- C = 0
- Set HeaderRange = Range(Range("A1"), Range("A1").End(xlToRight))
- Set ClearRange = Range("A2", "AZ20000")
- ClearRange.ClearContents
- While Not (Doc Is Nothing)
- ColNum = 0
- ' Get item names from across the top row
- For Each ItemName In HeaderRange.Cells
- Debug.Print (ItemName)
- V = Doc.GETITEMVALUE(ItemName)
- For Each Value In V
- Sheets("Sheet1").Range("A2").Offset(RowNum, ColNum) = Value
- ColNum = ColNum + 1
- Next
- 'Tack the NotesURL on the end
- Sheets("Sheet1").Range("A2").Offset(RowNum, ColNum) = Doc.NOTESURL
- Next
- Set Doc = Docs.GETNEXTDOCUMENT(Doc)
- RowNum = RowNum + 1
- Wend
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement