Hi
So I am trying to run a mail merge from a button on a worksheet (called Data) into a Word template populating the template from rows of data on the ‘Data’ sheet. The data starts in row 2 and there can be up to 9999 rows with data in columns A to F.
Plain English steps are when clicking the button:
Open word template (Template.doc).
Check if row 2 on ‘Data’ worksheet is empty (cell A2 blank).
If it is blank put out a message ‘No data to process’ and close word template.
If not blank then insert row 2 data items (cells A2-F2) into template.
Do a ‘Save As’ to save a Word document with file name concatenated from a value in cell A1, todays run date, run time and value in col A (unique identifier) into a file location (say C:word_docs). Example word doc name is ‘Company A_20230227_18:05:17_0001.doc’
Loop back up and repeat for row 3 data.
Loop until col A on the row is blank (ie., hits an empty row).
Close word template.
Put out message ‘Processing complete’.
I haven’t managed to achieve this and what I have so far is very inelegant!
Is this possible to do? Any help really appreciated.
TIA.
So I am trying to run a mail merge from a button on a worksheet (called Data) into a Word template populating the template from rows of data on the ‘Data’ sheet. The data starts in row 2 and there can be up to 9999 rows with data in columns A to F.
Plain English steps are when clicking the button:
Open word template (Template.doc).
Check if row 2 on ‘Data’ worksheet is empty (cell A2 blank).
If it is blank put out a message ‘No data to process’ and close word template.
If not blank then insert row 2 data items (cells A2-F2) into template.
Do a ‘Save As’ to save a Word document with file name concatenated from a value in cell A1, todays run date, run time and value in col A (unique identifier) into a file location (say C:word_docs). Example word doc name is ‘Company A_20230227_18:05:17_0001.doc’
Loop back up and repeat for row 3 data.
Loop until col A on the row is blank (ie., hits an empty row).
Close word template.
Put out message ‘Processing complete’.
I haven’t managed to achieve this and what I have so far is very inelegant!
Is this possible to do? Any help really appreciated.
TIA.