web development India freelance website designer
Send current document with Lotus Notes from Word

Returns:A new memo in drafts folder that is opened and the current document from MS Word is
attached.

Assumes:Only tested with Lotus Notes 4.6.2a.
You need To edit Normal.dot and add this subrutine so that it always is avalible For the users. You
also need to add a icon or shotcutkey(preferable Ctrl+M). You need to disable UNC paths for MS
Word, see http://support.microsoft.com/support/kb/articles/Q171/4/06.ASP?LN=EN-US&SD=
gn&FR=0

Side Effects:Lotus Notes must be running and logged on.

Sub SaveAndSendDocumentWithLotusNotes()
Dim doc As Object
Dim rtitem As Object
Dim Body2 As Object
Dim cUNID As String
Dim ws As Object
Dim doc2 As Object
Dim oSess As Object
Dim oDB As Object
Dim file As String
'use 'on error resume next so that the user never will get an error
'only the dialog "You have new mail" i Lotus Notes can stop this macro
'on error resume next
Set oSess = CreateObject("Notes.NotesSession")
'access the logged on users mailbox
Set oDB = oSess.GETDATABASE("", "")
Call oDB.OPENMAIL

'save the document if not saved, dialog "Save as..." is presented if the user has not saved yet.

If ActiveDocument.Saved = False Then
ActiveDocument.Save
End If
'Remember to edit registry to disable UNC paths in MS Word
'Lotus Notes can't handle UNC paths in programming
file = Word.ActiveDocument.FullName
'HKEY_CURRENT_USER\software\Microsoft\Office\8.0\Word\Options
'DontUseUNC=1 REG_DWORD

Set workspace = CreateObject("Notes.NOTESUIWORKSPACE")

Set doc = oDB.CREATEDOCUMENT
Set rtitem = doc.CREATERICHTEXTITEM("Body")

'add 2 enter so that the attached file is being placed better
Call rtitem.ADDNEWLINE(2)

'attach file
Set Body2 = rtitem.EMBEDOBJECT(1454, "", file) 'EMBED_ATTACHMENT

'save Notes documents id so that we can reopen it and show it for the user
cUNID = doc.UNIVERSALID

'save document to Drafts filder
Call doc.Save(True, True)

Set doc2 = oDB.GETDOCUMENTBYUNID(cUNID)
Set ws = CreateObject("Notes.NotesUIWorkspace")
'open document in the user enviroment
Call ws.EDITDOCUMENT(True, doc2)
'Access Lotus Notes and make it the current application
'The path to Lotus Notes is by default installation of Lotus Notes set in the enviroment variables
Call Shell("notes.exe", 1)

End Sub


Send current document with Lotus Notes from Wo

1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700

Freelance ASP PHP web development | Web developer India Web development India| Prayagasoft - web designer India, Ecommerce developer india, Ecommerce design