Hi.
I have a macro excel file that has a mail merge function with Word.
I have a total of 9 records under RESULT tab. And I have 2 Word templates where if cell AW1 is 'Inventory', then it will pick up the 'Inventory' template, else it will pick up the 'Marketing' template. I used the if and else function for this. And this goes in a loop.
Now, overall my vba code is working with a loop (9 records). However,there is one thing that I need to add to my existing code. From another tab of same excel file which is "Dates" tab, I wanted to paste the dates table as well to my Word template, provided that the chosen template picked is 'Inventory' template. If it is Marketing template, no action is done.
For example (see sample below and sorry if formatting is not in table), I have an individual template auto-generated by macro for Reference 1 and the template chosen is 'Inventory' template. With this, the dates table from 'Dates' tab should also be exported to the very last page of the 'Inventory' Word Template. Then, this goes in loop til the last record (record #9 ). The problem is I dont know the vba code for this. Mail merging cannot be done coz the record dates per reference is going vertically, (not horizontally). Could somebody help me formulate the code? Many thanks.
If there is anything that needs more clarification, pls let me know. I'm not sure if I made myself clear.
PS: Is this going to be added in Module? Just wondering.
DATES table from 'Dates' tab
Reference: 1 Reference: 2 Reference: 3 .................. Reference: 9
Expiry Setlement Expiry Setlement Expiry Setlement Expiry Setlement
15Jan17 17Jan 17 15Feb17 17Feb 17 15Mar17 17Mar 17 17Apr17 19Apr17
18Jan17 20Jan17 18Feb17 19Feb17 18Mar17 20Mar17 20Apr17 22Apr17
I have a macro excel file that has a mail merge function with Word.
I have a total of 9 records under RESULT tab. And I have 2 Word templates where if cell AW1 is 'Inventory', then it will pick up the 'Inventory' template, else it will pick up the 'Marketing' template. I used the if and else function for this. And this goes in a loop.
Now, overall my vba code is working with a loop (9 records). However,there is one thing that I need to add to my existing code. From another tab of same excel file which is "Dates" tab, I wanted to paste the dates table as well to my Word template, provided that the chosen template picked is 'Inventory' template. If it is Marketing template, no action is done.
For example (see sample below and sorry if formatting is not in table), I have an individual template auto-generated by macro for Reference 1 and the template chosen is 'Inventory' template. With this, the dates table from 'Dates' tab should also be exported to the very last page of the 'Inventory' Word Template. Then, this goes in loop til the last record (record #9 ). The problem is I dont know the vba code for this. Mail merging cannot be done coz the record dates per reference is going vertically, (not horizontally). Could somebody help me formulate the code? Many thanks.
If there is anything that needs more clarification, pls let me know. I'm not sure if I made myself clear.
PS: Is this going to be added in Module? Just wondering.
DATES table from 'Dates' tab
Reference: 1 Reference: 2 Reference: 3 .................. Reference: 9
Expiry Setlement Expiry Setlement Expiry Setlement Expiry Setlement
15Jan17 17Jan 17 15Feb17 17Feb 17 15Mar17 17Mar 17 17Apr17 19Apr17
18Jan17 20Jan17 18Feb17 19Feb17 18Mar17 20Mar17 20Apr17 22Apr17
Last edited: