we are using the following at the moment - which always says activex cannot create object when it gets to the line that says 'Set noSession = CreateObject("Notes.NotesSession")'
Dim noSession As Object, noDatabase As Object, noDocument As Object
Dim obAttachment As Object, EmbedObject As Object
Dim stSubject As Variant, stAttachment As String
Dim vaRecipient As Variant, vaMsg As Variant
Const EMBED_ATTACHMENT As Long = 1454
Const stTitle As String = "Active workbook status"
Const stMsg As String = "The active workbook must first be saved " & vbCrLf _
& "before it can be sent as an attachment."
'Check if the active workbook is saved or not
'If the active workbook has not been saved at all.
If Len(ActiveWorkbook.Path) = 0 Then
MsgBox stMsg, vbInformation, stTitle
'If the changes in the active workbook have been saved or not.
If ActiveWorkbook.Saved = False Then
If MsgBox("Do you want to save the changes before sending?", _
vbYesNo + vbInformation, stTitle) = vbYes Then _
'Get the name of the recipient from the user.
vaRecipient = Application.InputBox( _
Prompt:="Please add name of the recipient such as:" & vbCrLf _
& "email@example.com or just the name if internal mail within Unity.", _
Loop While vaRecipient = ""
'If the user has canceled the operation.
If vaRecipient = False Then Exit Sub
'Get the message from the user.
vaMsg = Application.InputBox( _
Prompt:="Please enter the message such as:" & vbCrLf _
& "Enclosed please find the weekly report.", _
Loop While vaMsg = ""
'If the user has canceled the operation.
If vaMsg = False Then Exit Sub
'Add the subject to the outgoing e-mail
'which also can be retrieved from the users
'in a similar way as above.
stSubject = Application.InputBox( _
Prompt:="Please add a subject such as:" & vbCrLf _
& "Weekly Report.", _
Loop While stSubject = ""
'Retrieve the path and filename of the active workbook.
stAttachment = ActiveWorkbook.FullName
'Instantiate the Lotus Notes COM's Objects.
Set noSession = CreateObject("Notes.NotesSession")
Set noDatabase = noSession.GETDATABASE("", "")
'If Lotus Notes is not open then open the mail-part of it.
If noDatabase.IsOpen = False Then noDatabase.OPENMAIL
'Create the e-mail and the attachment.
Set noDocument = noDatabase.CreateDocument
Set obAttachment = noDocument.CreateRichTextItem("stAttachment")
Set EmbedObject = obAttachment.EmbedObject(EMBED_ATTACHMENT, "", stAttachment)
'Add values to the created e-mail main properties.
.Form = "Memo"
.SendTo = vaRecipient
.Subject = stSubject
.Body = vaMsg
.SaveMessageOnSend = True
'Send the e-mail.
.PostedDate = Now()
.Send 0, vaRecipient
'Release objects from the memory.
Set EmbedObject = Nothing
Set obAttachment = Nothing
Set noDocument = Nothing
Set noDatabase = Nothing
Set noSession = Nothing
'Activate Excel for the user.
AppActivate "Microsoft Excel"
MsgBox "The e-mail has successfully been created and distributed.", vbInformation
please can someone help with this as it is a major nut job for me at the moment.
I tried several versions of code to get it to work - calling notes.notessession and lotus.notessession as well as .notesuiworkplace - the bit stopping any off them frmo working was that there was no registry - removed from all work pc's.
Now i have put it back i have got my excel vba version of the code to work perfectly - i will be finishing the vb.net version today with any luck.
In order to send using a group name, you must 'login' to Notes with the group name.
How to do that? Depends on how your LAN administrator and the Notes adminitrator (maybe is a unique person) have defined user authentication on both systems, if the authentication is integrated in an Active Directory or not, if the group is just an email distribution group, or can be used as an account, etc. Maybe you'll need to start a distinct thread for that.
My 'cheap' advice is to send the mails with your account, specifying some where the text: 'on behalf of the teamaccount'.
Hope this helps. I think your very first post on this thread is solved. Isn't? If yes, please be so kind to mark this thread as solved. Cheers.