Code problem any ideas?

wh00t

Registered User.
Local time
Today, 13:01
Joined
May 18, 2001
Messages
264
Hi there, I have the following code as a public sub, which I obtained from these forums...

-------------
Public Sub SendMail(strAddressee As String, strSubject As String, strBody As String)

Dim objNotesWS As Object
Dim notesdb As Object

Set objNotesWS = CreateObject("Notes.NotesUIWorkspace")

Set notesdb = objNotesWS.COMPOSEDOCUMENT(, , "memo")

notesdb.FIELDSETTEXT "EnterSendTo", strAddressee
notesdb.FIELDSETTEXT "Subject", strSubject
notesdb.FIELDSETTEXT "Body", strBody

notesdb.Send

notesdb.close
Set notesdb = Nothing
Set objNotesWS = Nothing


End Sub
----------------
but I have a problem

the theory is, I insert the following line of code onto another section where I wish to activate this code

SendMail("gareth.chappell@manor-bakeries.co.uk","Test","This is a test mail")

but it says '= expected'

any help would be appreciated
 
Remove the () from your line of code
SendMail("gareth.chappell@manor-bakeries.co.uk","Test","This is a test mail")

Example
SendMail "gareth.chappell@manor-bakeries.co.uk","Test","This is a test mail"


Jerid
 
Thanx for that, works great

is there anyway I can adjust this to be able to e-mail a report from the db?
 
The reason you didn't need the () is because you were not collecting the return value from the function. (SendMail returns a value) If you do then the () would need to stay.

Example
vReturn = SendMail("gareth.chappell@manor-bakeries.co.uk","Test","This is a test mail")

As far as your second question goes:
I don't think so, not unless you rebuild the report in the body of the eMail line by line. (That would requires a good amount of code.

Sorry
 

Users who are viewing this thread

Back
Top Bottom