Word and Notes

I am in the process of writing a macro for MS Word which will attach the current Word document to a new instance of a notes document. The code below does just that:

Dim doc As Object

Dim ws As Object

Dim worddoc As String

Dim rtitem As Variant

Dim backdoc As Object

Dim file As Variant

Dim subject As String

subject = InputBox(“Please enter a subject”, “Document Subject”)

If subject <> “” Then

Set ws = CreateObject(“Notes.NotesUIWorkspace”)

Set doc = ws.composedocument(“ServerName”, “FileName”, “document”)

Call doc.fieldsettext(“subject”, subject)

Call doc.Save(True, False)

Set backdoc = doc.Document

Application.ActiveDocument.Save

worddoc = Application.ActiveDocument.FullName

Set rtitem = backdoc.getfirstitem(“body”)

Set file = rtitem.EmbedObject(1454, “”, worddoc)

Else

MsgBox (“You did not enter a subject. Please click the button again.”)

End If

However, the idea is that the user will then continue to work on the newly created Notes document, however the focus stays on Word, and not Notes.

Does anyone know how I can then get the focus no the Notes document? I’ve tried using prompts etc, but nothing brings the Notes application to the foreground. Even tried minimising Word, but that only works if Notes is the next visible application.

Subject: Word and Notes

Found the answer myself:

AppActivate “Lotus Notes”

Hopefully that’ll help someone else :slight_smile: