Skip to main content
This forum is closed to new posts and responses. New discussions are now taking place in the IBM Developer Answers forum.
Information Mgmt
New to Lotus
How to buy
Live demos
Technical library
Forums & community
Java™ technology
Open source
SOA and Web services
Web development
My developerWorks
About dW
Submit content

developerWorks  >  Lotus  >  Forums & community  >  Notes/Domino 6 and 7 Forum

Notes/Domino 6 and 7 Forum



PreviousPrevious NextNext

Albert Alvarez 26.Mar.13 12:48 PM a Web browser
Notes Client 7.0.2 Windows Vista

I've been researching and researching and I can't seem to find an answer for how to add an attachment to a Lotus Notes document using VBA. I've seen how to embed and attach an object, but these don't work for me. I might be having troubles understanding what each of those do???? All I want to do is the equivalent of clicking on File, then Attach... and attaching my document in a field. The field name (I think) is $FILE (or FuncSpec)- at least that's how it appears when I look at the document properties.

The script fills in other fields and that part works perfectly

This is what I have (if it's commented out, it's been tried and it failed):

Dim dbname As String
Dim dbpath As String
Dim NotesUIWorkspace As Object
Dim NotesUIDocument As Object
Dim strDoc As String
Dim obAttachment As Object, EmbedObject As Object

Set NotesUIWorkspace = CreateObject("Notes.NotesUIWorkspace")

dbname = "Notes_DBs\lotusdoc.nsf"
dbpath = "SenGan5/SGCM"

Call NotesUIWorkspace.OpenDatabase(dbpath, dbname, "By Issue Date (2)", , False, False)

Set NotesUIDocument = NotesUIWorkspace.COMPOSEDOCUMENT(dbpath, dbname, "Document")
Call NotesUIDocument.FIELDSETTEXT("Body", strDoc)
Call NotesUIDocument.GOTOFIELD("Body")
Call NotesUIDocument.Paste

Call NotesUIDocument.FIELDSETTEXT("Document", Format(Now(), "YY") & "/" & strNumber)
Call NotesUIDocument.FIELDSETTEXT("Categories", "Bulletin")
Call NotesUIDocument.FIELDSETTEXT("Product", "Lotus")
Call NotesUIDocument.FIELDSETTEXT("Recipient", "All Clients")
Call NotesUIDocument.FIELDSETTEXT("Subject", "Bulletin # " & strNumber & " " & strSubject)
Call NotesUIDocument.FIELDSETTEXT("Type", "Bulletin")
stAttachment = "G:\Memo\123.doc"
'Call NotesUIDocument.GOTOFIELD("FuncSpec")
'Call NotesUIDocument.FIELDSETTEXT("FuncSpec", "G:\Memo\123.doc")
'Call NotesUIDocument.CreateObject("WordDocument", "", "G:\Memo\123.doc")
'Call NotesUIDocument.EmbedObject(1454, "", "G:\Memo\123.doc")
'Call NotesUIDocument.CreateObject("Attachment", "G:\Memo\123.doc")
'Set obAttachment = NotesUIDocument.CreateRichTextItem("FuncSpec")
'Set EmbedObject = obAttachment.EmbedObject(EMBED_ATTACHMENT, "", stAttachment)


VBA, Lotus Notes and attaching a fi... (Albert Alvarez 26.Mar.13)
. . RE: VBA, Lotus Notes and attaching ... (Martha Geppert 26.Mar.13)
. . . . RE: VBA, Lotus Notes and attaching ... (Albert Alvarez 28.Mar.13)
. . . . . . RE: VBA, Lotus Notes and attaching ... (Karl-Henry Mart... 28.Mar.13)
. . . . . . RE: VBA, Lotus Notes and attaching ... (Rich Schwartz 29.Mar.13)

  Document options
Print this pagePrint this page

 Search this forum

  Forum views and search
Date (threaded)
Date (flat)
With excerpt
Advanced search

 RSS feedsRSS
All forum posts RSS
All main topics RSS
More Lotus RSS feeds


Forum use and etiquette
Native Notes Access
Web site Feedback

Lotus Support

 Lotus Support
IBM Support Portal - Lotus software
Lotus Support documents
Lotus support by product
Lotus support downloads
Lotus support RSS feeds


IBM Composite Applications
IBM Mashup Center
IBM Connections
IBM Connections Cloud Developers
IBM Docs
IBM Forms
IBM Mobile Connect
IBM Sametime
IBM SmartCloud for Social Business
IBM Web Experience Factory
Lotus Domino
Lotus Domino Designer
Lotus Expeditor
Lotus Foundations
Lotus iNotes
Lotus Instructor Community Courseware
Lotus Notes
Lotus Notes & Domino Application Development
Lotus Notes Traveler
Lotus Protector
Lotus Quickr
Lotus Symphony
IBM Web Content Manager
WebSphere Portal

Lotus Forums

 Lotus Forums
Notes/Domino 9.0
Notes/Domino 8.5 + Traveler
Notes/Domino XPages development forum
Notes/Domino 8
Notes/Domino 6 and 7
IBM Connections
IBM Mobile Connect
IBM Sametime
IBM SmartCloud Notes
Lotus Enterprise Integration
Lotus Protector
Lotus Quickr
Lotus SmartSuite