Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Xbase Fox > Re: VFP 9: Outl...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 4 of 6 Topic 829 of 861
Post > Topic >>

Re: VFP 9: Outlook Automation Problem

by Gene Wirchenko <genew@[EMAIL PROTECTED] > Jan 30, 2008 at 09:46 PM

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.
 




 6 Posts in Topic:
VFP 9: Outlook Automation Problem
Gene Wirchenko <genew@  2008-01-30 16:56:38 
Re: VFP 9: Outlook Automation Problem
"Paul Pedersen"  2008-01-30 20:04:40 
Re: VFP 9: Outlook Automation Problem
Gene Wirchenko <genew@  2008-01-30 21:14:19 
Re: VFP 9: Outlook Automation Problem
Gene Wirchenko <genew@  2008-01-30 21:46:38 
Re: VFP 9: Outlook Automation Problem
"Dan Freeman" &  2008-02-02 13:05:57 
Re: VFP 9: Outlook Automation Problem
Gene Wirchenko <genew@  2008-02-03 22:27:40 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Dec 5 10:39:52 CST 2008.