Gene Wirchenko <genew@[EMAIL PROTECTED]
> wrote:
>"Paul Pedersen" <nospam@[EMAIL PROTECTED]
> wrote:
>
>>This might be too obvious, but you do have this in there somewhere,
right?
>>
>>#DEFINE olMailItem 0
>
> I would rather someone ask than miss the answer. Yes, I do have
>that #define and a few others, too.
How about I post the code?
cclishad is a data object that contains data on the current
client. CHRCR is chr(13)
***** Start of Included Code *****
* createanemail
* Create an E-mail for One Client
* Last Modification: 2008-01-29
procedure createanemail
lparameters;
theclcode,; && =C: clcode of client to E-mail to.
fsaveem,; && =L: save the E-mail? .t.=yes, .f.=no
fsendem,; && =L: send the E-mail? .t.=yes, .f.=no
justone && =L: working on just one client? .t.=yes, .f.=no
* cclishad has been initialised with the data for theclcode.
[deleted E-mail contents setup code]
*
* Create the E-mail.
*
local statusmsg
statusmsg=""
local savememow
savememow=set("memowidth")
set memowidth to 60
#define olMailItem 0
#define olTo 1
#define olCC 2
#define olBCC 3
local ooutlook, omailitem
ooutlook=createobject("Outlook.Application")
omailitem=ooutlook.CreateItem(olMailItem)
with omailitem
* .From=alltrim(csysshad.fromem) && no such property
.Subject="IMA Accounting "+doclistup
.Body=embody
with .Recipients
local clines, i, whom, fresolved
clines=memlines(cclishad.emto)
for i=1 to clines
emaddr=mline(cclishad.emto,i)
if !empty(emaddr)
whom=.Add(emaddr)
whom.Type=olTo
endif
endfor
clines=memlines(cclishad.emcc)
for i=1 to clines
emaddr=mline(cclishad.emcc,i)
if !empty(emaddr)
whom=.Add(emaddr)
whom.Type=olCC
endif
endfor
fresolved=.ResolveAll()
endwith
if !fresolved
if !empty(statusmsg)
statusmsg=statusmsg+CHRCR
endif
if justone
statusmsg=statusmsg+;
"Warning: Access was unable to resolve all E-mail addresses for this
client."
else
statusmsg=statusmsg+;
"Warning: Access was unable to resolve all E-mail addresses for client
";
+theclcode+"."
endif
endif
for i=1 to cemfiles
.Attachments.Add(epdir+"\"+emflist(i,1))
&& This is correct as epdir is where the emflist files
now are.
endfor
endwith
if fsaveem
omailitem.Save()
endif
if fsendem
omailitem.Send()
endif
omailitem=.null.
ooutlook=.null.
if !empty(statusmsg)
statusmsg=statusmsg+CHRCR
endif
statusmsg=statusmsg+"The E-mail has been created."
set memowidth to (savememow)
[deleted file maintenance code]
return .t.
endproc
***** End of Included Code *****
Sincerely,
Gene Wirchenko
Computerese Irregular Verb Conjugation:
I have preferences.
You have biases.
He/She has prejudices.


|