Hi, thanks for taking the time to read this problem. I'm trying to build a spreadsheet which will be used every time a new contract is booked centrally to email the offices who will receive it, and tell them what they need to know about it. I have one sheet which is just a big email list that will look somewhat like this:</SPAN>
[TABLE="class: grid, width: 271"]
<TBODY>[TR]
[TD]Office</SPAN>
[/TD]
[TD]Manager Email</SPAN>
[/TD]
[/TR]
[TR]
[TD]Office 1</SPAN>
[/TD]
[TD]Email 1</SPAN>
[/TD]
[/TR]
[TR]
[TD]Office 2</SPAN>
[/TD]
[TD]Email 2</SPAN>
[/TD]
[/TR]
[TR]
[TD]Office 3</SPAN>
[/TD]
[TD]Email 3</SPAN>
[/TD]
[/TR]
</TBODY>[/TABLE]
Etc, down the page for 100 or so addresses.
Then a second sheet will contain all the data that needs to be sent out, which is already generated in another file. That table, with the top left cell A1 will look like this:</SPAN>
[TABLE="class: grid, width: 359"]
<TBODY>[TR]
[TD]Office</SPAN>
[/TD]
[TD]Office 1</SPAN>
[/TD]
[TD]Office 2</SPAN>
[/TD]
[TD]Office 3</SPAN>
[/TD]
[/TR]
[TR]
[TD]Office Area</SPAN>
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Client</SPAN>
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Client Area</SPAN>
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Project Code:</SPAN>
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Date Begun:</SPAN>
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Due Completion:</SPAN>
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Number of Items:</SPAN>
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</TBODY>[/TABLE]
This table will extend horizontally for as many offices as will be involved in the contract, but always only 8 cells down.
I've got all this format set up, but what I'm struggling with is the VBA to check which offices are in the contracts table (this will vary hugely by contract) and then send each one an email containing only the two columns of data pertaining to them. (The headings in column A for everyone, and the specific column for the office.)
Complicating things slightly further I have so far been unable to send any emails from excel (in my heavily restricted work computer system) other than by using the "mail envelope" VBA. I believe this is to do with emails being sendable by macro in excel but not through Outlook, however I'm no expert, as you may be able to tell from this problem, so any proposed solution at all would be massively appreciated.</SPAN>
[TABLE="class: grid, width: 271"]
<TBODY>[TR]
[TD]Office</SPAN>
[/TD]
[TD]Manager Email</SPAN>
[/TD]
[/TR]
[TR]
[TD]Office 1</SPAN>
[/TD]
[TD]Email 1</SPAN>
[/TD]
[/TR]
[TR]
[TD]Office 2</SPAN>
[/TD]
[TD]Email 2</SPAN>
[/TD]
[/TR]
[TR]
[TD]Office 3</SPAN>
[/TD]
[TD]Email 3</SPAN>
[/TD]
[/TR]
</TBODY>[/TABLE]
Etc, down the page for 100 or so addresses.
Then a second sheet will contain all the data that needs to be sent out, which is already generated in another file. That table, with the top left cell A1 will look like this:</SPAN>
[TABLE="class: grid, width: 359"]
<TBODY>[TR]
[TD]Office</SPAN>
[/TD]
[TD]Office 1</SPAN>
[/TD]
[TD]Office 2</SPAN>
[/TD]
[TD]Office 3</SPAN>
[/TD]
[/TR]
[TR]
[TD]Office Area</SPAN>
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Client</SPAN>
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Client Area</SPAN>
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Project Code:</SPAN>
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Date Begun:</SPAN>
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Due Completion:</SPAN>
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Number of Items:</SPAN>
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</TBODY>[/TABLE]
This table will extend horizontally for as many offices as will be involved in the contract, but always only 8 cells down.
I've got all this format set up, but what I'm struggling with is the VBA to check which offices are in the contracts table (this will vary hugely by contract) and then send each one an email containing only the two columns of data pertaining to them. (The headings in column A for everyone, and the specific column for the office.)
Complicating things slightly further I have so far been unable to send any emails from excel (in my heavily restricted work computer system) other than by using the "mail envelope" VBA. I believe this is to do with emails being sendable by macro in excel but not through Outlook, however I'm no expert, as you may be able to tell from this problem, so any proposed solution at all would be massively appreciated.</SPAN>