Macro for mailing same PDF from same account regularly...

G

Guest

Hundreds of times daily, I need to send the identical PDF file to numerous
e-mail addresses ... one at a time. I'm New to Outlook macros, wondering if
this is possible:

Set Sender E-Mail Account as "(e-mail address removed)"
Place text "xxxxxxxxx" in "Subject" box;
Attach PDF file "YYY.PDF"
In text box, (open and) copy text contents of c:\TextToSend.txt
Go to "To" box, for my entry of recipient e-mail address

I've almost done it with the basic Record function that Outlook makes
available; however, recording stops if I tab-backspace out of the text box.

I'd love to get into basic VBA coding, don't know where on MS site to look
for all possible commands.

Any help would be appreciated.
 
M

Michael Bauer [MVP - Outlook]

I'd use a template, stored in the Drafts folder, with the subject and send
account pre-filled.

If the subject is unique you can get the item with:

Dim Mail as Outlook.MailItem
Dim Folder as Outlook.Mapifolder

Set Folder=Application.Session.GetDefaultFolder(olFolderDrafts)
Set Mail=Folder.items("subject here")

Add the attachment by calling the item's Attchments.Add method:

Mail.Attachments.Add "c:\yyy.pdf"

Write the txt file's content into the items Body property. Here's a sample
for reading files:

http://www.vboffice.net/sample.html?mnu=1&lang=en&smp=14&cmd=showitem

And add the recipients to the item's Recipients.Add method.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Quick-Cats - Categorize Outlook data:
<http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6>

Am Wed, 6 Jun 2007 10:54:01 -0700 schrieb Cheryl1325:
 
G

Guest

Hello Michael,

I'm wondering if you could advise how I'd go about this, as i could not get
what you earlier advised to work for me.

I did neglect to advise that I manage countless e-mails being sent out for
some 20+ individuals and was hoping to set a simple macro button for each of
2 possible files to be sent out by any of the 20+. That means I would simply
substitute e-mail senders and their one of two possible files in whatever
code, for 40 macros in total.

What I'd like to do the simple equivalent of follows:

--Ctrl-N for new e-mail;
--Assert sender's e-mail account;
--Insert Subject Matter "In response to your request...";
--Attach "XXXXXX.pdf";
--In mail's text box, insert contents of c:\yyyyyy.txt above existing
signature that automatically comes in by applying account of e-mail sender
(If, as a result of the macro's use, it won't come in as always, then I'll
add it to the incoming text file.
--Goto after the greeting "Dear " at the top of the text message so I can
type the recipient's name and a comma;
[--After ENTER is hit... Go to "TO:" box so I can enter the recipient's
e-mail address];

Then, I'll view everything and hit SEND.

Much of what I need here and so much more is available to be seen, no doubt,
on-screen in Office; I only wish I knew where, so I can begin to learn this.
I'm a 20-year+ veteran of Lotus 1-2-3 code and I'm surely willing and able to
begin soon as I know how.

I can probably get this done (or close) with my X-Keys programmable
keyboard, but I'd like to lose it and get started with VBA.

Many thanks.
 
M

Michael Bauer [MVP - Outlook]

What version do you use?

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Quick-Cats - Categorize Outlook data:
<http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6>

Am Sat, 9 Jun 2007 21:07:00 -0700 schrieb Cheryl1325:
Hello Michael,

I'm wondering if you could advise how I'd go about this, as i could not get
what you earlier advised to work for me.

I did neglect to advise that I manage countless e-mails being sent out for
some 20+ individuals and was hoping to set a simple macro button for each of
2 possible files to be sent out by any of the 20+. That means I would simply
substitute e-mail senders and their one of two possible files in whatever
code, for 40 macros in total.

What I'd like to do the simple equivalent of follows:

--Ctrl-N for new e-mail;
--Assert sender's e-mail account;
--Insert Subject Matter "In response to your request...";
--Attach "XXXXXX.pdf";
--In mail's text box, insert contents of c:\yyyyyy.txt above existing
signature that automatically comes in by applying account of e-mail sender
(If, as a result of the macro's use, it won't come in as always, then I'll
add it to the incoming text file.
--Goto after the greeting "Dear " at the top of the text message so I can
type the recipient's name and a comma;
[--After ENTER is hit... Go to "TO:" box so I can enter the recipient's
e-mail address];

Then, I'll view everything and hit SEND.

Much of what I need here and so much more is available to be seen, no doubt,
on-screen in Office; I only wish I knew where, so I can begin to learn this.
I'm a 20-year+ veteran of Lotus 1-2-3 code and I'm surely willing and able to
begin soon as I know how.

I can probably get this done (or close) with my X-Keys programmable
keyboard, but I'd like to lose it and get started with VBA.

Many thanks.





Michael Bauer said:
I'd use a template, stored in the Drafts folder, with the subject and send
account pre-filled.

If the subject is unique you can get the item with:

Dim Mail as Outlook.MailItem
Dim Folder as Outlook.Mapifolder

Set Folder=Application.Session.GetDefaultFolder(olFolderDrafts)
Set Mail=Folder.items("subject here")

Add the attachment by calling the item's Attchments.Add method:

Mail.Attachments.Add "c:\yyy.pdf"

Write the txt file's content into the items Body property. Here's a sample
for reading files:

http://www.vboffice.net/sample.html?mnu=1&lang=en&smp=14&cmd=showitem

And add the recipients to the item's Recipients.Add method.
Am Wed, 6 Jun 2007 10:54:01 -0700 schrieb Cheryl1325:
 
G

Guest

Hello Michael,

Currently 2003; switching soon to 2007.



Michael Bauer said:
What version do you use?

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Quick-Cats - Categorize Outlook data:
<http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6>

Am Sat, 9 Jun 2007 21:07:00 -0700 schrieb Cheryl1325:
Hello Michael,

I'm wondering if you could advise how I'd go about this, as i could not get
what you earlier advised to work for me.

I did neglect to advise that I manage countless e-mails being sent out for
some 20+ individuals and was hoping to set a simple macro button for each of
2 possible files to be sent out by any of the 20+. That means I would simply
substitute e-mail senders and their one of two possible files in whatever
code, for 40 macros in total.

What I'd like to do the simple equivalent of follows:

--Ctrl-N for new e-mail;
--Assert sender's e-mail account;
--Insert Subject Matter "In response to your request...";
--Attach "XXXXXX.pdf";
--In mail's text box, insert contents of c:\yyyyyy.txt above existing
signature that automatically comes in by applying account of e-mail sender
(If, as a result of the macro's use, it won't come in as always, then I'll
add it to the incoming text file.
--Goto after the greeting "Dear " at the top of the text message so I can
type the recipient's name and a comma;
[--After ENTER is hit... Go to "TO:" box so I can enter the recipient's
e-mail address];

Then, I'll view everything and hit SEND.

Much of what I need here and so much more is available to be seen, no doubt,
on-screen in Office; I only wish I knew where, so I can begin to learn this.
I'm a 20-year+ veteran of Lotus 1-2-3 code and I'm surely willing and able to
begin soon as I know how.

I can probably get this done (or close) with my X-Keys programmable
keyboard, but I'd like to lose it and get started with VBA.

Many thanks.





Michael Bauer said:
I'd use a template, stored in the Drafts folder, with the subject and send
account pre-filled.

If the subject is unique you can get the item with:

Dim Mail as Outlook.MailItem
Dim Folder as Outlook.Mapifolder

Set Folder=Application.Session.GetDefaultFolder(olFolderDrafts)
Set Mail=Folder.items("subject here")

Add the attachment by calling the item's Attchments.Add method:

Mail.Attachments.Add "c:\yyy.pdf"

Write the txt file's content into the items Body property. Here's a sample
for reading files:

http://www.vboffice.net/sample.html?mnu=1&lang=en&smp=14&cmd=showitem

And add the recipients to the item's Recipients.Add method.
Am Wed, 6 Jun 2007 10:54:01 -0700 schrieb Cheryl1325:

Hundreds of times daily, I need to send the identical PDF file to numerous
e-mail addresses ... one at a time. I'm New to Outlook macros, wondering
if
this is possible:

Set Sender E-Mail Account as "(e-mail address removed)"
Place text "xxxxxxxxx" in "Subject" box;
Attach PDF file "YYY.PDF"
In text box, (open and) copy text contents of c:\TextToSend.txt
Go to "To" box, for my entry of recipient e-mail address

I've almost done it with the basic Record function that Outlook makes
available; however, recording stops if I tab-backspace out of the text
box.

I'd love to get into basic VBA coding, don't know where on MS site to look
for all possible commands.

Any help would be appreciated.
 
M

Michael Bauer [MVP - Outlook]

In OL 2003 it's not possible to set the Send Account via the Outlook object
model, therefore I suggested to use a template: Create the email manually,
fill in everything that won't change, and click Save; that saves the item in
the Drafts folder. You can create one template for each of your individuals.

Or you use the Redemption (www.dimastr.com) to set the account easily by
code. See RDOMail Account property for a sample
(http://www.dimastr.com/redemption/rdo/default.htm).

Maybe you can assign one toolbar button to the code and send the emails to
all of the people at once, or you'll need something to decide for which
individual the message should be created - as it wouldn't be a good idea to
have one button for each on your toolbar.


--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Organize Outlook email:
<http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6>

Am Mon, 11 Jun 2007 08:04:02 -0700 schrieb Cheryl1325:
Hello Michael,

Currently 2003; switching soon to 2007.



Michael Bauer said:
What version do you use?
Am Sat, 9 Jun 2007 21:07:00 -0700 schrieb Cheryl1325:
Hello Michael,

I'm wondering if you could advise how I'd go about this, as i could not get
what you earlier advised to work for me.

I did neglect to advise that I manage countless e-mails being sent out for
some 20+ individuals and was hoping to set a simple macro button for
each
of
2 possible files to be sent out by any of the 20+. That means I would simply
substitute e-mail senders and their one of two possible files in whatever
code, for 40 macros in total.

What I'd like to do the simple equivalent of follows:

--Ctrl-N for new e-mail;
--Assert sender's e-mail account;
--Insert Subject Matter "In response to your request...";
--Attach "XXXXXX.pdf";
--In mail's text box, insert contents of c:\yyyyyy.txt above existing
signature that automatically comes in by applying account of e-mail sender
(If, as a result of the macro's use, it won't come in as always, then I'll
add it to the incoming text file.
--Goto after the greeting "Dear " at the top of the text message so I can
type the recipient's name and a comma;
[--After ENTER is hit... Go to "TO:" box so I can enter the recipient's
e-mail address];

Then, I'll view everything and hit SEND.

Much of what I need here and so much more is available to be seen, no doubt,
on-screen in Office; I only wish I knew where, so I can begin to learn this.
I'm a 20-year+ veteran of Lotus 1-2-3 code and I'm surely willing and
able
to
begin soon as I know how.

I can probably get this done (or close) with my X-Keys programmable
keyboard, but I'd like to lose it and get started with VBA.

Many thanks.





:



I'd use a template, stored in the Drafts folder, with the subject and send
account pre-filled.

If the subject is unique you can get the item with:

Dim Mail as Outlook.MailItem
Dim Folder as Outlook.Mapifolder

Set Folder=Application.Session.GetDefaultFolder(olFolderDrafts)
Set Mail=Folder.items("subject here")

Add the attachment by calling the item's Attchments.Add method:

Mail.Attachments.Add "c:\yyy.pdf"

Write the txt file's content into the items Body property. Here's a sample
for reading files:

http://www.vboffice.net/sample.html?mnu=1&lang=en&smp=14&cmd=showitem

And add the recipients to the item's Recipients.Add method.
Am Wed, 6 Jun 2007 10:54:01 -0700 schrieb Cheryl1325:

Hundreds of times daily, I need to send the identical PDF file to numerous
e-mail addresses ... one at a time. I'm New to Outlook macros, wondering
if
this is possible:

Set Sender E-Mail Account as "(e-mail address removed)"
Place text "xxxxxxxxx" in "Subject" box;
Attach PDF file "YYY.PDF"
In text box, (open and) copy text contents of c:\TextToSend.txt
Go to "To" box, for my entry of recipient e-mail address

I've almost done it with the basic Record function that Outlook makes
available; however, recording stops if I tab-backspace out of the text
box.

I'd love to get into basic VBA coding, don't know where on MS site to look
for all possible commands.

Any help would be appreciated.
 
G

Guest

Hello Michael,

Just switched to Outlook 2007; would the macro work now? I would have
switched to 2007 just for this alone...




Michael Bauer said:
In OL 2003 it's not possible to set the Send Account via the Outlook object
model, therefore I suggested to use a template: Create the email manually,
fill in everything that won't change, and click Save; that saves the item in
the Drafts folder. You can create one template for each of your individuals.

Or you use the Redemption (www.dimastr.com) to set the account easily by
code. See RDOMail Account property for a sample
(http://www.dimastr.com/redemption/rdo/default.htm).

Maybe you can assign one toolbar button to the code and send the emails to
all of the people at once, or you'll need something to decide for which
individual the message should be created - as it wouldn't be a good idea to
have one button for each on your toolbar.


--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Organize Outlook email:
<http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6>

Am Mon, 11 Jun 2007 08:04:02 -0700 schrieb Cheryl1325:
Hello Michael,

Currently 2003; switching soon to 2007.



Michael Bauer said:
What version do you use?
Am Sat, 9 Jun 2007 21:07:00 -0700 schrieb Cheryl1325:

Hello Michael,

I'm wondering if you could advise how I'd go about this, as i could not
get
what you earlier advised to work for me.

I did neglect to advise that I manage countless e-mails being sent out for
some 20+ individuals and was hoping to set a simple macro button for each
of
2 possible files to be sent out by any of the 20+. That means I would
simply
substitute e-mail senders and their one of two possible files in whatever
code, for 40 macros in total.

What I'd like to do the simple equivalent of follows:

--Ctrl-N for new e-mail;
--Assert sender's e-mail account;
--Insert Subject Matter "In response to your request...";
--Attach "XXXXXX.pdf";
--In mail's text box, insert contents of c:\yyyyyy.txt above existing
signature that automatically comes in by applying account of e-mail sender
(If, as a result of the macro's use, it won't come in as always, then I'll
add it to the incoming text file.
--Goto after the greeting "Dear " at the top of the text message so I can
type the recipient's name and a comma;
[--After ENTER is hit... Go to "TO:" box so I can enter the recipient's
e-mail address];

Then, I'll view everything and hit SEND.

Much of what I need here and so much more is available to be seen, no
doubt,
on-screen in Office; I only wish I knew where, so I can begin to learn
this.
I'm a 20-year+ veteran of Lotus 1-2-3 code and I'm surely willing and able
to
begin soon as I know how.

I can probably get this done (or close) with my X-Keys programmable
keyboard, but I'd like to lose it and get started with VBA.

Many thanks.





:



I'd use a template, stored in the Drafts folder, with the subject and
send
account pre-filled.

If the subject is unique you can get the item with:

Dim Mail as Outlook.MailItem
Dim Folder as Outlook.Mapifolder

Set Folder=Application.Session.GetDefaultFolder(olFolderDrafts)
Set Mail=Folder.items("subject here")

Add the attachment by calling the item's Attchments.Add method:

Mail.Attachments.Add "c:\yyy.pdf"

Write the txt file's content into the items Body property. Here's a
sample
for reading files:

http://www.vboffice.net/sample.html?mnu=1&lang=en&smp=14&cmd=showitem

And add the recipients to the item's Recipients.Add method.
Am Wed, 6 Jun 2007 10:54:01 -0700 schrieb Cheryl1325:

Hundreds of times daily, I need to send the identical PDF file to
numerous
e-mail addresses ... one at a time. I'm New to Outlook macros, wondering
if
this is possible:

Set Sender E-Mail Account as "(e-mail address removed)"
Place text "xxxxxxxxx" in "Subject" box;
Attach PDF file "YYY.PDF"
In text box, (open and) copy text contents of c:\TextToSend.txt
Go to "To" box, for my entry of recipient e-mail address

I've almost done it with the basic Record function that Outlook makes
available; however, recording stops if I tab-backspace out of the text
box.

I'd love to get into basic VBA coding, don't know where on MS site to
look
for all possible commands.

Any help would be appreciated.
 
M

Michael Bauer [MVP - Outlook]

In OL 07 setting the accoutn looks like this (you do have the email
already):

Dim Acct as Outlook.Account

Set Acct=Application.Session.Accounts("display name of account here")
Mail.SendUsingAccount=Acct

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Organize Outlook email:
<http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6>

Am Wed, 13 Jun 2007 09:14:03 -0700 schrieb Cheryl1325:
Hello Michael,

Just switched to Outlook 2007; would the macro work now? I would have
switched to 2007 just for this alone...




Michael Bauer said:
In OL 2003 it's not possible to set the Send Account via the Outlook object
model, therefore I suggested to use a template: Create the email manually,
fill in everything that won't change, and click Save; that saves the item in
the Drafts folder. You can create one template for each of your individuals.

Or you use the Redemption (www.dimastr.com) to set the account easily by
code. See RDOMail Account property for a sample
(http://www.dimastr.com/redemption/rdo/default.htm).

Maybe you can assign one toolbar button to the code and send the emails to
all of the people at once, or you'll need something to decide for which
individual the message should be created - as it wouldn't be a good idea to
have one button for each on your toolbar.
Am Mon, 11 Jun 2007 08:04:02 -0700 schrieb Cheryl1325:
Hello Michael,

Currently 2003; switching soon to 2007.



:



What version do you use?
Am Sat, 9 Jun 2007 21:07:00 -0700 schrieb Cheryl1325:

Hello Michael,

I'm wondering if you could advise how I'd go about this, as i could not
get
what you earlier advised to work for me.

I did neglect to advise that I manage countless e-mails being sent out for
some 20+ individuals and was hoping to set a simple macro button for each
of
2 possible files to be sent out by any of the 20+. That means I would
simply
substitute e-mail senders and their one of two possible files in whatever
code, for 40 macros in total.

What I'd like to do the simple equivalent of follows:

--Ctrl-N for new e-mail;
--Assert sender's e-mail account;
--Insert Subject Matter "In response to your request...";
--Attach "XXXXXX.pdf";
--In mail's text box, insert contents of c:\yyyyyy.txt above existing
signature that automatically comes in by applying account of e-mail sender
(If, as a result of the macro's use, it won't come in as always, then I'll
add it to the incoming text file.
--Goto after the greeting "Dear " at the top of the text message so I can
type the recipient's name and a comma;
[--After ENTER is hit... Go to "TO:" box so I can enter the recipient's
e-mail address];

Then, I'll view everything and hit SEND.

Much of what I need here and so much more is available to be seen, no
doubt,
on-screen in Office; I only wish I knew where, so I can begin to learn
this.
I'm a 20-year+ veteran of Lotus 1-2-3 code and I'm surely willing and able
to
begin soon as I know how.

I can probably get this done (or close) with my X-Keys programmable
keyboard, but I'd like to lose it and get started with VBA.

Many thanks.





:



I'd use a template, stored in the Drafts folder, with the subject and
send
account pre-filled.

If the subject is unique you can get the item with:

Dim Mail as Outlook.MailItem
Dim Folder as Outlook.Mapifolder

Set Folder=Application.Session.GetDefaultFolder(olFolderDrafts)
Set Mail=Folder.items("subject here")

Add the attachment by calling the item's Attchments.Add method:

Mail.Attachments.Add "c:\yyy.pdf"

Write the txt file's content into the items Body property. Here's a
sample
for reading files:

http://www.vboffice.net/sample.html?mnu=1&lang=en&smp=14&cmd=showitem

And add the recipients to the item's Recipients.Add method.
Am Wed, 6 Jun 2007 10:54:01 -0700 schrieb Cheryl1325:

Hundreds of times daily, I need to send the identical PDF file to
numerous
e-mail addresses ... one at a time. I'm New to Outlook macros, wondering
if
this is possible:

Set Sender E-Mail Account as "(e-mail address removed)"
Place text "xxxxxxxxx" in "Subject" box;
Attach PDF file "YYY.PDF"
In text box, (open and) copy text contents of c:\TextToSend.txt
Go to "To" box, for my entry of recipient e-mail address

I've almost done it with the basic Record function that Outlook makes
available; however, recording stops if I tab-backspace out of the text
box.

I'd love to get into basic VBA coding, don't know where on MS site to
look
for all possible commands.

Any help would be appreciated.
 

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