automaticbaby
Technical User
I have searched endlessly for some help with this, but so far I have not come across anything useful (or maybe I'm missing something). From Access, I am trying to open a database in Lotus Notes, open a new document and fill in some of the fields and attache a document. I have been able to do it all except for attaching the document. Here is the code I have:
There is a comment in the code, where I am also looking to paste from the word doc to a field in Lotus Notes and I want to keep all the formating. Help with that would be appreciated.
Thanks in advance!
Albert
Code:
Dim dbname As String
Dim dbpath As String
Dim NotesUIWorkspace As Object
Dim NotesUIDocument As Object
Dim object As NotesEmbeddedObject
Dim notesrtf As Object
Dim strVariable as String
Dim strDoc as string
Set NotesUIWorkspace = CreateObject("Notes.NotesUIWorkspace")
dbname = "db_notes.nsf"
dbpath = "chi_server/Service Team"
Call NotesUIWorkspace.OpenDatabase(dbpath, dbname, "By Issue Date (2)", , False, False)
Set NotesUIDocument = NotesUIWorkspace.COMPOSEDOCUMENT(dbpath, dbname, "Document")
' need to figure out how to copy and paste to below using rich text
Call NotesUIDocument.FIELDSETTEXT("Body", strDoc)
Call NotesUIDocument.GOTOFIELD("Body")
NotesUIDocument.Selection.PasteSpecial
Call NotesUIDocument.FIELDSETTEXT("Document", Format(Now(), "YY") & "/" & strVariable)
Call NotesUIDocument.FIELDSETTEXT("Categories", "Miscellaneous")
Call NotesUIDocument.FIELDSETTEXT("Product", "API")
Call NotesUIDocument.FIELDSETTEXT("Recipient", "All Clients")
Call NotesUIDocument.FIELDSETTEXT("Subject", "Number " & strVariable & " " & "Title")
Call NotesUIDocument.FIELDSETTEXT("Type", "Memo Release")
' doesn't work
Call NotesUIDocument.GOTOFIELD("FuncSpec")
Call NotesUIDocument.FIELDSETTEXT("FuncSpec", "G:\Memo\123.doc")
' doesn't work
Set object = NotesUIDocument.EmbedObject(1454, "", "G:\Memo\123.doc")
' this will attach the entire document (IE copy and paste) to the field
Call NotesUIDocument.CreateObject("WordDocument", "", "G:\Memo\123.doc")
' doesn't work
Call notesrtf.EmbedObject(1454, "", "G:\Memo\123.doc", "Attachment")
' doesn't work
Call NotesUIDocument.CreateObject("Attachment", "G:\Memo\123.doc")
Thanks in advance!
Albert