file\Automation-Embedding.nsf does not exist message occuring as part of my macro
Hi
I have found some vba code which automatically sends an email via excel 2010 through lotus notes. This works perfectly with one annoying exception. Each time I run the code, I receive the following lotus notes pop up message "file\Automation-Embedding.nsf does not exist" at the following points in the vba code:
Set NSession = CreateObject("Notes.NotesSession")
Set NUIWorkSpace = CreateObject("Notes.NotesUIWorkspace")
The pop up message gives me the option of clicking "Ok" and by doing so I am able to successfully run the rest of the code which does do exactly what I want. However, I do not want to have to manually click okay twice. Is there a way of
a) Altering my lotus notes settings so that this pop up message does not occur (I have never seen this message before except when running this macro)
OR
b) Adding some code to my vba code (shown below) which will automatically click "Ok" for me and save me manually having to do this.
Would really appreciate your help!
Here is my macro code:
Sub Send_Email()
Application.DisplayAlerts = False
Dim NSession As Object
Dim NUIWorkSpace As Object
Dim NDoc As Object
Dim NUIdoc As Object
On Error Resume Next
Set NSession = CreateObject("Notes.NotesSession")
Set NUIWorkSpace = CreateObject("Notes.NotesUIWorkspace")
Set NDoc = NUIWorkSpace.ComposeDocument("", "", "Memo")
Set NUIdoc = NUIWorkSpace.CURRENTDOCUMENT
With NUIdoc
.FieldSetText "EnterSendTo", "nicolla_eagar@westpac.co.nz"
'.FieldSetText "EnterCopyTo", "cc.email@email.com"
.FieldSetText "Subject", "Test Email " & Now
.FieldSetText "Body", " " & vbNewLine & vbNewLine & _
"**PASTE EXCEL CELLS HERE**" & vbNewLine & vbNewLine & _
" "
.GotoField ("Body")
.FINDSTRING "**PASTE EXCEL CELLS HERE**"
Sheets("Report").Range("B2:G20").Copy 'the cells to copy and paste
.Paste
Application.CutCopyMode = False
.Send
.Close
End With
Set NUIdoc = Nothing
Set NDoc = Nothing
Set NUIWorkSpace = Nothing
Set NSession = Nothing
End Sub
Recent comments
5 years 36 weeks ago
6 years 22 weeks ago
6 years 34 weeks ago
6 years 37 weeks ago
6 years 38 weeks ago
6 years 43 weeks ago
6 years 52 weeks ago
7 years 2 days ago
7 years 3 days ago
7 years 3 days ago