Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access thread: Code for email not working - help!


Message #1 by "Tammy Tappan" <GRTappan@e...> on Fri, 25 Jan 2002 16:49:02
Okay, "Al" posted some code for me to call Lotus Notes & send an emial 

message. It's not working! When I try to run it, I get a type mismatch 

error, & the debug points to Set NotesMailDoc = NotesDB.CREATEDOCUMENT



The whole code is:



Option Compare Database

Option Explicit

Dim NotesSession As Object

Dim NotesDB As Object

Dim NotesMailDoc As NOTESDOCUMENT

Dim NotesRTF As Object

Dim NotesDocID As String

Dim Attachment As Object

Dim EmbedObject As Object

Dim NotesMsg As String





Public Function OpenNotes() As Boolean

     

    Set NotesSession = GetObject("", "Notes.Notessession")

    MsgBox "Start Lotus Notes & Press the <OK> button when Lotus Notes is 

fully open...", _

    vbOKOnly, "OpenNotes()"

    'If the preceding "stall" is not inserted, you're 90% guaranteed to 

bomb... _

      Lotus Notes is really slow to open!

    

    Set NotesDB = NotesSession.GETDATABASE("", "") 'Default Database

    

    If Not NotesDB.ISOPEN Then

        Call NotesDB.OPENMAIL 'Open Lotus Notes Mail

    End If

    

    OpenNotes = True

    

End Function



Public Function SendIDReq()

    

    Dim strIDReq As String

    

    strIDReq = "Don," & vbCrLf & vbCrLf & _

    "Please add " & "to the ServiceCenter Database as a new user." & 

vbCrLf & _

    "Attached is the request document with all of the details." _

    & vbCrLf & vbCrLf & "Thank-you" & vbCrLf & vbCrLf





    If OpenNotes = True Then

    

    Set NotesMailDoc = NotesDB.CREATEDOCUMENT

    NotesMailDoc.Form = "Memo"

    NotesMailDoc.FROM = NotesSession.COMMONUSERNAME

    NotesMailDoc.SendTo = "Don Beam/D20/DCF"

    NotesMailDoc.SAVEMESSAGEONSEND = True

    NotesMailDoc.Subject = "ServiceCenter ID Request for "

    NotesMailDoc.body = strIDReq

    NotesMailDoc.SEND (True)

        

    End If



End Function



Any & all help will be greatly appreciated!



+Tammy

  Return to Index