SHARE
TWEET

Untitled

a guest Sep 19th, 2019 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ' Requires that LotusNotes Item/Field names are entered across the first row in a sheet
  2. ' E.g. Try adding Title, Status, Initiator on the first row
  3. ' Fills out values based on criteria entered in "SearchString" - currently set to "Author is me"
  4. Sub GetDocProps()
  5.     Set Session = CreateObject("Lotus.NotesSession") 'Start a session to notes
  6.     strPass = ""
  7.     Call Session.Initialize(strPass)
  8.     strSrv = ""
  9.     strDb = ""
  10.     Set Db = Session.GETDATABASE(strSrv, strDb)
  11.     ' Get this string by right clicking in a document form once it is opened
  12.     SearchString = "@Contains(@Author;" & Chr(34) & Application.UserName & Chr(34) & ")"
  13.     Set dtime = Session.CREATEDATETIME("01/08/2019 00:00:01 AM")
  14.     Set Docs = Db.Search(SearchString, dtime, 0)
  15.     Set Doc = Docs.GETFIRSTDOCUMENT
  16.     C = 0
  17.     Set HeaderRange = Range(Range("A1"), Range("A1").End(xlToRight))
  18.     Set ClearRange = Range("A2", "AZ20000")
  19.     ClearRange.ClearContents
  20.     While Not (Doc Is Nothing)
  21.         ColNum = 0
  22.         ' Get item names from across the top row
  23.         For Each ItemName In HeaderRange.Cells
  24.             Debug.Print (ItemName)
  25.             V = Doc.GETITEMVALUE(ItemName)
  26.             For Each Value In V
  27.                     Sheets("Sheet1").Range("A2").Offset(RowNum, ColNum) = Value
  28.                     ColNum = ColNum + 1
  29.             Next
  30.             'Tack the NotesURL on the end
  31.             Sheets("Sheet1").Range("A2").Offset(RowNum, ColNum) = Doc.NOTESURL
  32.         Next
  33.         Set Doc = Docs.GETNEXTDOCUMENT(Doc)
  34.         RowNum = RowNum + 1
  35.     Wend
  36. End Sub
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top