VBA to email clients on a certain date based on excel 2010 doc.

musicman715

New Member
Joined
Jul 15, 2011
Messages
45
Hi All,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
I am working on a macro to that emails my clients one week before their invoice is due. The first part of my code opens a data sheet called “Invoice Email Data Sheet” and copies info from the Excel Invoice over to specific columns in the “Invoice Email Data Sheet”. However, I cannot record macro that records my actions in our accounting software, so I cannot automatically get this info to copy over from our accounting software to the correct column in excel 2010. I do not have IT clearance to download a whole computer macro program in order to achieve this copying and pasting over from our accounting software automatically. So I can and have been doing that copying and pasting manually to get the email address copied from our accounting software over to my excel data sheet.<o:p></o:p>
1. Is there a way to do this exclusively with excel VBA, or do I have to have a whole computer macro program to record the clicks, and copy actions in our accounting software?<o:p></o:p>
Here are the column headings in the “Invoice email data sheet”. A is Invoice #, B is Event Name, C is Invoice Date, D is Due Date, E is Invoice Amount, F is Contact Email, and H4 is Today’s Date (I put it in H4 because if I put it in row 2 with all the rest of my first row of data and heading in row 1, it messes up when I run the macro to copy over the info from the invoice.)<o:p></o:p>
Here’s a slice of code to copy and paste the info over from the Invoice to the “Invoice Email data sheet”<o:p></o:p>
Range("AA8:AE8").Select ‘this is a range from the actual invoice<o:p></o:p>
Selection.Copy<o:p></o:p>
Windows("Invoice Email Data Sheet.xlsx").Activate<o:p></o:p>
Range("A2").Select<o:p></o:p>
ActiveSheet.Paste<o:p></o:p>
2. What is the code instead of Range (“A2”).Select to make excel select the next open row in column A so that the Invoice # that’s already in cell “A2” is not overwritten, and so that I each time the macro runs it selects the next open cell (without writing already in there) in the appropriate column<o:p></o:p>
Once I’ve copied all the information over to the “Invoice Email Data Sheet”:<o:p></o:p>
3. What is the code to say, execute next section of code only on ‘Enter’ keypress from the last non-blank cell in column F (This is where my email addresses will be.)<o:p></o:p>
4. The final code I need is to set up an email to be sent from Microsoft outlook 1 week prior to the due date in Column D to the “Contact Email” in column F that says,<o:p></o:p>
“To Whom it may concern,<o:p></o:p>
Your Invoice (# from last open cell in column A) for (Last open cell in column B…event name and number) dated (Column C), for (Amount in column E) is due in 1 week on (Due Date in column D)<o:p></o:p>
Thank You for your business,”<o:p></o:p>
I want the information in parentheses to be automatically pulled from my data sheet.<o:p></o:p>
Here’s the hitch…I want it to go out 1 week prior to the due date from column D, and I’ll be adding new info to the data sheet each time I create an invoice so that another email can be sent for each invoice I create and I don’t want excel to get confused as to which row it is pulling data from when it sets up the email to be sent from outlook, and creates the email in outlook.<o:p></o:p>
Any help is greatly appreciated. If you have a response to a particular question number, please label it, so I know which question the answer goes with.<o:p></o:p>
Thanks,<o:p></o:p>
Musicman715<o:p></o:p>
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.

Forum statistics

Threads
1,224,599
Messages
6,179,831
Members
452,946
Latest member
JoseDavid

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top