Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


How to open Object which is stored in Richtext Field.

Posted on 1999-06-23
Medium Priority
Last Modified: 2013-12-18
Dear Expert,

We are using Lotus-Notes 4.6.1. We are facing some problem with opening the word file object stored in the Richtext field of the document.

i.e Field "rt" is the Richtext field in the form, inwhich the word object is created.

1->      Dim workspace As New NotesUIWorkspace
      Dim uidoc As NotesUIDocument
      dim wordobj as variant

      Set uidoc = workspace.CurrentDocument
      Call uidoc.GotoField("rt")
      Set wordobj = uidoc.CreateObject("Word Doc","word.document")

Above code is used to create the word object in the document's RichText field, at the creation time of the document When user press the Launch Word Button.The word application is automatically open with blank document.

To retrive the created word document we use the following script to get the word object stored in the richtext field of the document.

2->      Dim workspace As New NotesUIWorkspace
      Dim uidoc As NotesUIDocument
      dim wordobj as variant

      Set uidoc = workspace.CurrentDocument
      Call uidoc.GotoField("rt")
      Set wordobj = uidoc.GetObject( "Word Doc" )

the wordobj is set but we can't see the already created word document.

We want the things like: when the user press the button the "2->" script runs it opens the word application(we can do this thing) with the existing word document which is sotred in the richtext field.

We know that this thing can be done through Form's Launch Tab option, but we can't use that option.

When we make right click to the Richtext field, in which the word document is created we have many options, two of them is "Edit" and "Open" by clicking "Open" existing word document is opened with the Word application. we want to minimize the click by just pressing one button called "Open Attach Word Document". In that button the "2->" script is written.

With Regards,

Nilesh Shah.
Question by:Aurokripa
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Expert Comment

ID: 1119512
As far as I know the GetObject method only opens or returns the currently open instance of the OLE application. It doesn't actually perform any methodm to open a particular file. Look at the NotesEmbeddedObject class and the Activate method. This may give you what you want.

Author Comment

ID: 1119513
Hi, ghart.

Thanks for your response. I can do the partial things which i exactly want. I can open the existing embedded object using Notes Embedded Class, but now the problem is the existing embedded object doesn't sustain at word application. The word application opens with our embedded object(stores in richtext field) but when the script is finished then the document is closed from the word application.

I am using the following script:

Dim workspace As New NotesUIWorkspace
     Dim uidoc As NotesUIDocument
     Dim doc As NotesDocument
     Dim ritem As Variant
     Dim wordobj As NotesEmbeddedObject
     Dim handle As Variant
     Set uidoc = workspace.CurrentDocument
     Set doc = uidoc.document
     Call uidoc.GoToField("richtext")
     Set ritem = doc.GetFirstItem("richtext")
     Set wordobj = ritem.GetEmbeddedObject("Word Doc")    
     Set handle = wordobj.Activate(True)
     Call wordobj.Doverb( "&Open" )
End Sub

Waiting for your positive reply,

Nilesh Shah

Expert Comment

ID: 1119514
If I understand you right, Word opens with the document but it gets closed when the execution of the script is finished ?
You might want to take a look at the Notes help of the Yield function and the ActivateApp function. Maybe this is was you need.

Sorry if I misunderstood.
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Accepted Solution

HaraldR earned 200 total points
ID: 1119515
Try to declare wordObj and handle as global variables, you might have to declare some of the other variables as global as well. The reason your word document closes is that wordObj gets out of scope when your button is finished with its script. But if you declare them as global, you will merely use existing variables.

Hope this solves your problem.
Harald R.


Author Comment

ID: 1119516
Dear Expert Paebdb,

      Thank you very very much for your valuable reply, you understand the right what i mean to say. Through the Activate method of the NotesEmbeddedObject the Microsoft Word is open with the Word document which is store in the richtext field(according to the reply of ghart).

      I refere the Yield and ActivateApp function of LotusScript, But the problem is, it uses the API (GetModuleUsage) to check whether the Word is open or not?  For that you have to generate one integer variable using shell method. In our case we already have the word object (which can be get by getobject method.). so can u please guide me (with the code) that how can i use Yield function with already created object.

      I am using the script which is written above. please refere it.

Awaiting for your positive and valuable reply.

Nilesh Shah

Author Comment

ID: 1119517

Thanks a lot for guiding us with a simple solution. I think you must have worked hard and a lot with Notes and must have faced such problems. We are so greatful to you for giving us a perfect answer. We hope in future you will guide us when ever we required your help.

Thanks a lot again,

With regards,

Nilesh shah


Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You’ve got a lotus Domino web server, and you have been told that “leverage browser caching” is a must do. This means that we have to tell the browser everywhere in the web to use cache. In other words, we set (and send) an expiration date in the HT…
  In today’s Arena we can’t imagine our lives without Internet as we are highly used to of it. If we consider our life style just for only 2 min we found that face to face communication is swapped by e-communication.  Every Where from Works place to…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

704 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question