Word Integration

In this article, I’ll show how you can launch word from Lotus Notes and transfer data to/from bookmarks in the word document

Create a new Word document
        Set obj = CreateObject(“Word.Application”)
        Call obj.documents.add()
        set w = obj.ActiveWindow

Create a Word document from a file
        Set obj = CreateObject(“Word.Application”)
        Call obj.documents.open( filename )
        Set w = obj.ActiveDocument

To save the changes you can use
        Call w.save()
or
        Call w.saveAs( filename)

Write data from Notes to a bookmark in the word document
        ‘Bookmark insert and recreate
        Dim bmRange As Variant
        Set bmRange = w.Bookmarks( nameOfBookmark ).Range
        bmRange.Text = Cstr( value ) ‘insert new text
        w.Bookmarks.Add position, bmRange ‘recreate the bookmark

or read data from a bookmark
        value = w.Bookmarks( nameOfBookmark ).Range.Text

More ressources

Checkout the Attachmate script library in my Design Template database. In this database you have full integration to Word and Excel – like a light version of Intregra or Swing ..
How to use a single VBA procedure to read or write both custom and built-in Document Properties
If your are developing VBA in Lotus Notes – you do need the Microsoft Constant Database

 

2 tanker om "Word Integration"

Skriv et svar

Din e-mailadresse vil ikke blive publiceret. Krævede felter er markeret med *

*