Hello,
i am opening a word file(stored in word document) when i am opening the form(QueryOpen event), can anybdoy please help me to achive this
i am using getattachment method , but how to open the word file on form open event.
On QueryOpen event i have written following code
Sub Queryopen(Source As Notesuidocument, Mode As Integer, Isnewdoc As Variant, Continue As Variant)
Dim session As New NotesSession
Dim doc As NotesDocument
Dim db As NotesDatabase
Dim view As NotesView
Dim keyDoc As notesdocument
Dim object As NotesEmbeddedObject
Dim rtitem As NotesRichTextItem
Set db = session.CurrentDatabase
Set view = db.GetView("Keyword")
Set keyDoc = view.GetDocumentByKey("Attachment")
If Not keyDoc Is Nothing Then
Set rtitem = keyDoc.GetFirstItem("Attachment")
If keydoc.HasItem("$File") Then
Set object = keydoc.GetAttachment("DIE_AuditReport_3rdMarch_V1.1.doc")
Dim wordApp As Variant
wordApp=CreateObject("Word.application")
Call wordApp.Open(object)
End If
End If
End Sub
please help
Dev
Subject: GetAttachment Method
You need to detach the file to the file system before opening it.
Subject: RE: GetAttachment Method
can you please let me throgh snipet of code.
and my requirement is that i should open it without detaching it
or can i remove that file later one.
DEV
Subject: RE: GetAttachment Method
Look at the ExtractFile method of the NotesEmbeddedObject class. As for deleting the file, when were you planning to do that? Remember – a user is working with the file after your code is done.
Subject: RE: GetAttachment Method
I want that word doc as an attachment after saving(Rich text field) the document?
is it possible? then how?
Many Thanks
Dev
Subject: RE: GetAttachment Method
Look, that functionality is already built in – let the user open the document in edit mode, edit the attachment and save the word document and the Notes document. Since you have no way of knowing from the Notes side when the user is finished with the Word document, you would need to run code in the Word document to save itself, remove the old version from the Notes document and attach the new version of itself – and you’re still left with a Word file on disk. There’s no need to re-invent the wheel.
Subject: RE: GetAttachment Method
Could you plese let me how can i open the word file once i will extract it on temp folder. once i will open the word template it would be saved one another form (Actually i am opening from keyword document),
You mean to say i have to programme somecode in MS- word itself…
how to achive this.
Actually way to work is:
I have stored one word template(in keyword document) that would store as keyword ( As user is offentely changing the word template)
when i am opening the one form this word template(from keyword document) should opened and once they close the word it should save as an atttachment into richtext filed of the open form.
Can you round me once again, if i get confused anywhere in this wheel.
Dev