LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 88
Default Lotus Notes CreateObject

Hi All,
I'm having a problem with a piece of code that has been made
available but i cant get it to work. I'm trying to open Lotus Notes to email
updates to individuals.

Code as follows:-

Sub Send_Active_Sheet()

Const EMBED_ATTACHMENT As Long = 1454
Const stPath As String = "D:\Store Returns\data\Attachments"
Const stSubject As String = "Store Updates"
Const vaMsg As Variant = "The Individual Store Updates as requested." _
& vbCrLf & "Kind Regards"
Const vaCopyTo As Variant = "


Dim stFileName As String
Dim vaRecipients As Variant
Dim noSession As Object
Dim noDatabase As Object
Dim noDocument As Object
Dim noEmbedObject As Object
Dim noAttachment As Object
Dim stAttachment As String

'On Error GoTo Error_handler



MsgBox " You have made at least 5 Updates" & vbNewLine & vbNewLine & _
"These Updates will now be emailed to Lee Remsbery", vbOKOnly & vbInformation

Application.ScreenUpdating = False

'Copy the Update sheet to a new temporarily sheet
ActiveWorkbook.Unprotect Password:=Passwd
Sheets("Update").Visible = True
Sheets("Update").Select

With ActiveSheet
.Copy
stFileName = .Range("A1").Value
End With

stFileName = "Attachment"

'Save and Close the Temporarily Workbook
With ActiveWorkbook
.SaveAs stPath & ".xls"
.Close
End With

' Create a list of recipients.
vaRecipients = ")

' Instantiate the Lotus Notes COM's Objects
Set noSession = CreateObject("Notes.NotesSession")
Set noDatabase = noSession.GETDATABASE("", "")

' If Lotus Notes is not open then open-mail part of it
If noDatabase.IsOpen = False Then noDatabase.OPENMAIL

' Create the e-mail and the attachment.
Set noDocument = noDatabase.CreateDocument
Set noAttachment = noDocument.CreateRichTextItem("stAttachment")

Set noEmbedObject = noAttachment.EmbedObject(EMBED_ATTACHMENT, "",
stAttachment)

' Add values to the created e-mail main properties
With noDocument
.Form = "Memo"
.SendTo = vaRecipients
.CopyTo = vaCopyTo
.Subject = stSubject
.Body = vaMsg
.SaveMessageOnSend = True
.PostedDate = Now()
.Send 0, vaRecipients
End With

'Delete the temporarily workbook
Kill stAttachment

'Release objects from memory
Set noEmbedObject = Nothing
Set noAttachment = Nothing
Set noDocument = Nothing
Set noDatabase = Nothing
Set noSession = Nothing

MsgBox "The e-mail has successfully been created and distrubuted",
vbInformation

Error_handler:

End Sub

My problem is when it gets to "Instantiate the Lotus Nots COM's Object' it
falls over with run-time error 429 'ActiveX component can't create object'

I'm aware that the object must find a key with an .lic extension, which may
be the problem. if so can anyone help with this issue or maybe this is not
the problem and I've totaly overlooked something. Does anyone have any ideas.
Please Help!!

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Lotus Notes Steve Excel Discussion (Misc queries) 0 February 25th 09 08:27 PM
lotus notes email pdaws Excel Worksheet Functions 2 October 2nd 08 04:08 PM
Mail über Lotus Notes aus Excel heraus/ Sending Mail with Excel through Lotus Notes [email protected] Excel Programming 0 February 19th 07 12:11 PM
Excel/Lotus Notes StephanieH Excel Programming 2 December 9th 04 08:11 AM
Lotus Notes Newbie Excel Programming 0 September 20th 04 01:55 PM


All times are GMT +1. The time now is 07:10 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"