#Automate mail merge from excel vba code#
Trying to code all this into a macro will end up generating something that's a nightmare to maintain. You should indeed create the mailmerge main document with all the boilerplate text and field coding you require.
![automate mail merge from excel vba automate mail merge from excel vba](https://www.automateexcel.com/excel/wp-content/uploads/2018/09/automacro-vba-code-generator-main.png)
![automate mail merge from excel vba automate mail merge from excel vba](https://www.exceltip.com/wp-content/uploads/2015/06/image-235.png)
I'm a novice with VBA, but I've picked, plucked and manipulated basic code well enough to give something 'more exciting' a go. The required table has three columns - one for the comments in the Well section, one for the OK section and one for the Bad section. , Bad 54 (for the the things they don't do well on - Well 1 relates to the same skill as OK1 and Bad 1 so only one of these will ever be filled in for each row. The data table is on a sheet called 'Breakdown' and has columns surname, forename, Well 1, well 2.well 54 (for the things they do well) OK1, OK 2.,OK54 (for the OK skills) and Bad 1, Bad 2. Is there any chance VBA (button) can be created/manipulated to automatically produce the tables (one for each row). I could manually create a mail-merge document using word/publisher that pulls in the things the person can do ('Well#'), the things they can start but not finish ('OK#') and the things they cannot do ('Bad#') - essentially putting all the well comments in one column of a feedback table, OK comments in the middle column and Bad in the end column.however, whilst I am capable of creating the mail-merge document manually, I am mindful that not everyone will be able to who might wish to use it. The columns are based on what a person can/cannot do and have one of three titles (one for each skill, 'Well#', 'OK#'' or 'Bad#') - it is this information I want to put into a single table for the individual (where# is a number between 1 and 54 for the possibility of 54 skills requiring analysis)
![automate mail merge from excel vba automate mail merge from excel vba](https://www.xelplus.com/wp-content/uploads/2021/04/Email-from-Excel-with-Attachments-01.png)
The scenario: I have 200 rows of data - one row for each person I have upto 200 column headers (in the first row), with an individual's data in the columns if relevant (if not relevant, the column for that row is set to blank) - the cells are filled in based on that individual's results and not all columns are always used. Not sure this is even possible but I've got so far in a project as a novice I'm now wanting to push the boundaries that little bit more!