Macro - Outlook

E

Edgar

Hi

I am trying to write a macro to automatically send out
remittances to our clients when we have made a payment to
them.

The document is an HTML but I assumed the best way of
doing this was to open in word and then write a macro in
word to email out to an email address on the document. I
can get this document into outlooks new message screen but
as soon as i click on the 'TO:' field the macro wont
record it. I guess this is because i am recording the
macro in word and outlooks is a different program. Is
there any way of doing this?

Thanks
 
R

Rollin_Again

So the recipient of the email is contained in text within the word
document?

Are there more than one recipents contained in this word document? Is
the word document something that is created as a new document daily or
is it the same document with changes being made and then resaved.

I need to know this stuff because it affects whether your code should
be stored saved in Outlook or Word.


Either way, it is very possible to do what you are asking. I need more
specific details of the entire process that you currently do manually.
Please be as detailed as possible.

Rollin
 
E

Edgar

It is a new document that we create weekly and the only.
There is only one recepient in the document which i also
have stored in a excel list.

The document is a remittance advice that we create from
Crystal Reports and then have to send out to the relevant
email address. At the moment we are creating an HTML
remittance and then just attaching it to an email and then
manually pasting in contact email addess.

Let me know if you require any further info.

Many thanks for your help.
 
R

Rollin_Again

How many remitances do you submit per week? Do you follow a certain
naming scheme for each of the filenames? I assume that each of the
remittances is saved as a seperate document? If you want a macro to
create a seperate email with a remittance attachment for each, then you
need to have some way of knowing what each of the seperate remittances
are named so your macro knows which files to open and then use as the
attachment.

The reason for this is that it is eaiest to accomplish your goal by
creating a loop that will execute the same task multiple times. The
first process within the loop is to open the first remittance (word
document) read the email address from it, and among other things email
itself to the appropriate person. Your first time your run your macro
the code needs to know which word document to open the first time and
which onces to open each time when it loops. You can hard code each of
the email addresses into your code but this would be very time
consuming. Another way to be able to accomplish this is to name each
of the remittances with the same naming scheme and use an incrementing
counter variable appended to the end of the file name. You then would
use a For Loop and each time the code loops the counter variable will
increase by 1 and the code will know to grab the next file in the
order. (i.e. the first time the code will look for file vFile(1), the
second time it will look for vFile(2), vFile(3), etc.) This method is
not recommended because all of your file names will be identical
(vFile) except for the number appended to the end of it and it will be
very hard for you to know who's remittance you have without opening
each document and manually checking it.

A easier solution is to maintain a list of names for whom the
remittances represent. For example you have a list with the names
"John Smith", "Mike Jones", "Kevin Johnson."

Each of these names has a file named after them (i.e. - "John Smith
Remittance.doc, "Mike Jones Remittance.doc, etc" In your code you
would set a variable called vName equal to the the first name on the
list. The first time through the code the variable vName would be set
equal to the first name on the list "John Smith." Your code would then
say to open the remittance document "vName" which is equal to "John
Smith." When the code loops it would look to the second name on the
list and set it equal to the the variable vName. The code would now
use this info to open the correct remittance file named "Mike Jones
Remittance" which is now represented by the variable vName.. Each time
the code loops the variable vName will be re-set to the next name on
the list and will use the info to open the appropriate file. I hope
this makes sense.

Rollin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top