I had received help in creating the agent below to load pdf files from a specific location. The question now is can I put this code into a button that allows a user to pull a specific document from the file. Can I get them a messagebox asking for the budget number or something to identify the file?
'Attach PDFs (ALL) and load into view
Sub Click(Source As Button)
Dim session As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim rtitem As NotesRichTextItem
Dim object As NotesEmbeddedObject
Dim pathName As String, fileName As String
Dim filesToGet As String, filePathName As String
pathName$ = "S:\IS\Report_Export_Test\Endow_to_lotus\Final\FinishedFinancial06\"
filesToGet$ = pathName$ + "*.pdf"
fileName$ = Dir$(filesToGet$, 0 )
Set db = session.CurrentDatabase
Do While fileName$ <> ""
Set doc = New NotesDocument( db )
Set rtitem = New NotesRichTextItem( doc, "pdf" ) 'in quotes = attachment field name
filePathName$ = pathName$ + fileName$
Set object = rtitem.EmbedObject(EMBED_ATTACHMENT, "", filePathName$)
doc.Form = "donorpdf2006"
doc.fy = 2006
doc.fullbudget = fileName$
Call doc.Save( True, True )
fileName$ = Dir$( )
Loop
End Sub