Mail Merge to separate documents (.docx .pdf) with custom file names and folders

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi everyone Nicholas here from Sunny Cyprus and welcome to today's tutorial I believe it's a fantastic tutorial and if you're an educator of you've used mail merge at any point in time either in your workplace or for personal reasons you will find this tutorial interesting now it's all about mail merge but not the traditional type of mail most usually when we mail merge a document we have as we can see over here a data source which is an Excel file down here it's called student names we have a document I've called it marksheet and then if we've got let's say 20 records in our data source and our document is two pages we end up with a very large and long document which is 40 pages long and the whole point of mail merge is to personalize these documents we make a personal document for each person inside that data source that makes it really really hard where we want to break down and create the individual documents for each person in our database so if you want to save a document for each person we then need to break down that very young document into very small pieces save the document give it a proper name let's say the person's name and repeat this again and again and again it becomes very tedious and we just basically don't bother mail merging the document so today's tutorial is basically to solve that problem so we're going to use this uh Excel sheet that I've got over here and a mark sheet over here which is a Word document but I'm not only going to mail merge a Word document I'm going to show you that we can mail merge an actual PDF into separate personalized PDFs as well so if you're an if you are an educator you use past papers or past exam papers to give to your students so they familiarize themselves with exam questions we end up using those Mark Sheets and those Mark Sheets of PDFs so if we want to personalize these Mark Sheets one for each student this solution would generate those PDFs those marksheets for you automatically so essentially what happens when I'm going to mail merge instead of producing one very long document it's going to let's say I've got 20 names inside the the student names over the index so far it's going to produce for me 20 documents and each document will have a customized file name the name of the student for example and maybe a description I've called this like the student name and the word Mark sheet and it's also in another folder it's going to generate the PDFs the same copy the same version in a PDF as well now do we need the PDF maybe yes maybe not that's entirely up to you now I'm going to start off by demonstrating this process first then I'm going to show you how you can implement it as well and finally in this video for those of you that are a little bit more tech savvy have a little bit of programming skills and you want to see how the program works I will break down the program for you so you can tweak it and do what you want with it so let's start straight away with the demonstration of watching a Word document and we're merging a PDF document okay so what we have here basically is a Word document which I've opened this word document is already linked as a mail merge process we're going to teach you mail merge I've got another video tutorial on that which I can link in the description below and essentially what it's going to do if we have a look at my this is my data source so I've only got one field that I'm going to be merging it's this one here it's going to be the full name these fields here don't worry about these for now we're going to use these later on you'll understand what these are for and why we're using them but essentially you can see the file name this is going to be the name that's going to be used to save each document with so for the mail modes process I'm only bringing in one field now you can have more Fields you can have for example the date of birth contact numbers email addresses parent information or whatever field you want to have in here but you will also need these three Fields as well for the process but we'll forget about that for now so let's just close out and go back to our mail merge so here we go so here's my document if I have a quick preview in my mail merge so if I go to mailings I can see I've got here all my recipients and normally if my mail Motors it will make one document and that document will be depending on how many records I've got say 12 records two pages is going to make it 24 pages long but that's not what I want so what I am going to do however is this I'm going to go to and I'm just going to just snap that into place I'm going to go to my developer a developer tab here don't worry about this I'm going to show you how to do this we're just demonstrating for now and once you've got this set up all you will have to do is click on this button here macros and click run that's it let's watch it happen so if I click on run now we can see here on the right hand side in these photos can you see how these PDF documents and Word Documents are being produced for us automatically and as many records as we've got in that data source that's how many PDF documents and that's how many Word documents it's going to generate these are going to be exactly the same as the document only if I just open this one up here for example and let's open up the the word one there you go can you see it's got that Student's name there so it's merged the field but it's also given the student name and the description which I want so this is a Amy Amy Booker wordmarksheet.x and I've got the same at the top as uh as also this one here as a PDF document okay now I want to also show you how we can do this with a PDF because it may be that you've got the mark sheet and you want to create a mark sheet for each student so let me just reset this I'll get back to you okay so here we can see I've got a PDF document this is a mark sheet from an actual exam paper and what I normally do is if I've got 20 students I will make 20 copies of the file and then I will rename each file one by one with the student's name and the whole purpose of this is to have personalized marksheets for my students I would then open the file ink on it so I can mark it save it and then attach each student's personalized marksheet in their Microsoft teams assignment where they've submitted their work but that's a very tedious job so I normally find other ways around this or I don't bother but now it's actually really easy have a look what I'm going to do I'm going to go to the word I'm gonna go open I'm going to go to browse I'm going to go and find my file my file is actually here in the merge folder and here's my PDF and I'm just going to double click to open this now you can see it's opened the PDF document you might get a little warning message in the middle that says word is converting the PDF and click OK once it's finished converting click OK and you will see this now from here we can see here is my mark sheet all I have to do now is exactly the same process because this is a Word document so I'm going to go and attach very quickly my style sheet this is part of the mail merging process so I'm going to go select recipients use an existing list my existing list again is in this same place there it is there click OK so I've attached my data source now if I want to go and add a field in here or not that's entirely up to me I don't really need to add a field but if I do I I can if I want to add the student's name in here as well so let's just do that really quickly if I go to my mailings I'm going to add a merge field for name there it is there and all I have to do just like before I'm simply going to go to my developer tab here I'll just bring this over here to the side go to my developer tab click on my Macross there we go and just run this and now the PDF document will be generated as a unique PDF document for every single student and a unique Word document we see the word documents here the individual ones and we can see at the top the PDF documents being generated and that's really really easy to do and I love this feature because most of the marches that I bought are PDF documents so I can make my personalized PDF documents very easily okay so now the next part of this video is to show you how you can do this as well okay so let's have a look and see what it is that we need to set up this whole process well the first thing that we need to do is to generate two folders where we're going to save our Word documents and PDF documents where you actually say them doesn't matter I suggest that you create one folder and put your subfolders inside I've put I've generated the folder here in the root directory in the C drive called it merge and I've added my PDF docs and my word docs folder here probably not a good idea to go in the route folder but I've done that so I can keep the path short you can save your main folder let's say this merge folder here you can put this anywhere in your documents on your desktop you can even put it in a synced OneDrive folder so if your OneDrive is actually synced and you've got a local copy of your OneDrive you can put it in there and that will automatically sync as well this will also work with a synced Dropbox folder or Google drive it really works on any anything where you've got um that cloud storage synced to your computer locally okay or you can just put it in your local Drive in your documents or your desktop so that's the first thing now what you name these is not important you can name them what you want the next thing that we need now this hidden here you don't need this we're going to I'm going to give you this because I'm going to give you this entire folder and in here you're going to find the modules um for the program you'll understand what that is in a second but you don't need them for the process you only need them one time next we need our documents that we're going to merge so if we're going to merge a merger Word document that we have our Word document here if we're going to merge a PDF we can bring that in here we don't need both but I use this as an example and the most important one now is the data source now the data source if I open this up now here we can see I've got a field and a column here it's called full name and it's got my student names here and then I've got these three columns now these three columns are not required to personalize the document but they are absolutely vital for the process to work what are these columns that I will show you how we generate them in a second the most important thing is that these three columns must be included in your data source and the name of these columns must be spelled exactly as you see them here unless you're going to stay towards the end of the tutorial see how it works and if you want to change these names in the program you can so if you spell these exactly the same so you're going to have three Fields doc folder PDF folder and file name you don't really need to do any modification to the program at all just copy paste it so this one here basically specifies where it's going to save the word document this one specifies where it's going to save the the PDF document and this column file name basically specifies what the file name is going to be when it's generated whether it's the word document or the PDF document so we generate these so I'm going to show you how we generate these now so if I delete this okay now you can have other columns as well for example uh students um contact details email address telephone number date of birth shoe size eye color whatever you want sport you can have all these fields in there to personalize your document but you must create these three columns as well so what's the first one the doc folder this is where we're going to save our Word documents so if I just bring that down here so if I've generated this one here this folder here word docs I'm going to click on this it might in Explorer Windows Explorer and when I open this at the top in the address bar here if I click one time it shows me the path so I'm just going to select that right click or Ctrl C copy and then I'm going to come to my spreadsheet and I'm going to paste that path there so basically this is the path it's going to follow to go and save the word documents and I'm simply going to copy that down for the rest of my records the PDF folder I'm going to do exactly the same thing so from here I'm going to go to my PDF doc so I'm going to open it click inside the Windows Explorer address bar at the top here there it is I'm going to select all of this right click copy go to my Excel document my data source right click paste and there is the password PDX documents so this mindset is not important where you generate these because you're going to put the path to these folders inside your data source I'm just going to copy that out now what you want to call each file name so one thing probably will be to have the student's name so to do that in Excel I'm just going to click on equals I'm going to click here so for this record it's going to take the student's name I'm then going to concatenate that with an apple sound and I'm going to put speech marks so this is going to link whatever I put in here I'm going to press space and I'm going to put say word mark sheet and close the speech marks okay so basically when I press enter what it's going to do is going to take whatever's inside A2 this this cell here the active cell here and it's going to link that's what the Ampersand does it says whatever's in here link it with whatever text I've written here so the text I've written I had to put the speech marks is space word Mark sheet so as soon as I press enter there we go and I can simply select this and copy that down so now I've generated the document folder where I could see my documents where I'm going to save my PDFs and what the name of each file is going to be the only thing I'm going to be importing for my mail merge is just the first name or the full name here but as I said you can have more items I'm going to save this and that is my data source finished okay all right so I now have my two folders but I'm going to save everything I've also got my data source let's now go to Microsoft Word and see what you need to do to set up this process so what I'm going to do now I'm going to open Microsoft Word I'm going to open up this document now you can see at the top here I've got this developer tab you need this because that's what you're going to use to generate the VB code or the mac and the macros if you don't have this just right click on any one of these ribbon headings or PSA I'll right click on mailings and from here you can go to customize the ribbon now on the right hand side over here where we are in customized room and you can go to the right hand side if you don't have the developer tag that means it's not ticked here so if I just click ok now you can see my developer tab has vanished if I want to re-enable it right click at the top on one of these ribbons customize the ribbon go to the right hand side and here I'm going to select my developer tab and click ok and here's the developer so the next thing that we need to do now is essentially to create the module or the macro which is going to be doing the whole process that we've learned so if I click on developer I first want to create the Visual Basic code I'm going to click on this and we should get this window now we're going to see on the left hand side that we taught this project window here if you don't see this project window so let's say I close that and you want to open it simply go to view and you should have here project Explorer and here it is so the next thing that we notice is we've got two projects we've got project marksheet and we've got the normal project project Mark sheet basically means if you see here the name of this file at the top is marksheet.x so essentially what it's saying is if I create my uh macro my module in this area it will only work for this document okay and you would have to do this every time for each document however if we actually create the macro in this area the normal this is basically the the default settings of every document that you open so if we generated in here we will be able to run the macro that we're going to generate from any document so anytime we want to do a mail merge we can run this macro without having to go through this process again so we're going to do that now the first step is I'm going to show you the longer way let's say and then I'm going to show you the easier way to do this so the one way to do this is if I right click anywhere if I right click on here where it says normal or right click on the modules let's say right click on normal I'm going to go to insert module and that's going to create this module one and in this window here we want to copy paste the code so I've got the code for you in this folder here VB modules so this one's saying you don't need this photo to save it in the with everything else but you can if you want to keep everything tight but it's not part of the process you only need it once so I've got for you here the text version and the Bas version the text version basically by double click on this I can simply press Ctrl a Ctrl C so we'll right click copy go over here right click paste that's it you've finished this is the code the green text over here are basically comments explaining what the code does we're going to look at this at the end of the video and that's it you've basically finished and that was the tricky part if you want to do this the easier way um you're going to do this I'm just going to close this I'm going to remove this module okay so remove module one no I don't want to back it up and the other way of doing this is simply right click on the normal part here and go to import file now if you go to the folder where I've put everything for you there we go in the merge VB modules I've got the bass file for you so if I just click on open select it and then opened that's it it's added it for you so if I double click on it there is it so you don't need to copy paste so either way it works well that's it you are finished that's all you need to do so I'm just going to click on Save and close the Visual Basic script if you want to see if it's worked if you click on Macros in the developer tab here and go to macros you will see You've now got this macro and you can run it but I can't run it yet because I haven't linked this document to a mail merge to a data source so let's do that now so I'm going to go to mailings and this is the process you would do to do mail merge under normal circumstances so I'm just going to go to select recipient use an existing list I'm going to go to where my data source is my data source is here okay that's a sheet I'm going to use click OK I know it's actually worked because all these buttons are now enabled I'm going to click at the top here for example and just go to insert merge field I'm only going to put the full name okay and if I have a look now and I go to preview results I can see it's actually there you go that student name here is changing as I'm going to the next record I can see here I've got 12 records okay so um essentially that's it let me show you now how you've simply export so once you've actually done the mail merge all you have to do is if I restore this and let me close that let's bring in those two windows in again so we can actually see this working okay so here are the two windows and I'm going to now simply go to my developer tab click on Macros and click or run and that's it you can see those documents and the PDFs at the top populated that's all you have to do and now the next time you want to do this so let me just show you with another document very quickly so I'm just going to delete all of these Ctrl a delete click in here Ctrl a delete those okay so now that I've put my macro where people look in the Visual Basic code because we put the module in normal you can see what happens now so if I close that document and close that document here do I want to save yeah it doesn't well let's just save it so it basically links it up okay um if I now go and open again my module so let's just go over here let's open this in the new window I don't need to do that again so if I want it now to do the same thing for this uh let's say this PDF document I can simply just go to a new word document word and if I just go to any new document if I go to my developer tab you can see the macro exists because we put it in that normal so if I was to bring in another document in here do the mail merge link the mail merge up link it to a data source all I would do have to do is just simply go to macros from the developer tab here and click on run and that's it you've got this set up permanently okay every document will have that availability okay that's essentially all you have to do uh the next step of this I'm going to explain to you how uh that code Works what it is that it's doing so if you do want to customize the code a little bit you can so I'm going to open up again this merge document which is already linked there you go it's asking if I want to access that data source I'm going to click that yes so we can see that automatically it is actually let's go to mailings and we can see that it's actually got that data already lit so what is this program doing well essentially if I wanted to do this manually so if we see how this process is done manually then we can understand a little bit clearer what the program's doing so if I wanted to generate each document one by one and save it with an actual file name a unique file name I would have to do it like this so I've already set up my my mail mode so we can see here in the edit recipient list so if I go to the edit recipient list I see I put 12 records here this one here is the first record narena homes and this one down here the code the Riley is the last record so I've got 12 records and if I want to create individual documents for each one of these uh students I would have to do it like this I will go to this section here we're going to finish and merge I will go edit individual documents I would not merge all of them because if I do that it's going to make that very long file okay with all the students Mark Sheets all in one document I will go to here which is from I will say from document from record number one to record number one only and then I'm going to click on OK and that what that's going to do that's only going to merge the first record okay from record one to record one I'm gonna click on OK here's that document you can see it's merged in this two document there's two pages and it's only for this student Loretta homes the next thing that I would do I will go to file save as I will browse to go find the location so if I'm going to do the word document I will go to this location and I will click on Save let's do that okay and then what I would do because this document is still open I will then go to file save as browse and then I will go to my other file path which is a PDF documents and save this I'm going to choose here as a PDF click OK save then I would close this document okay The Next Step will be to click on finish and merge again edit individual documents and this time I'm going to go from record number two to record number two click OK this is the next document I would then have to save this as a Word document and save it as a PDF document then close this I'm not going to save this now then go to finish emerge edit individual go to number three to three four to four private until I get to 12 to 12. now 12 I know is my last record I after I finish saving this last record I will stop and that's what the program does so let's go have a look and see that program so let's just close that so I'm going to go to my developer tab I'm going to go to Visual Basic and here is my code now on the green side over here these are basically comments explaining what each line does of this code I will go over this with you okay so the first line is basically declaring this subroutine you don't really need to do much it's just to name this routine here and basically it ends here so this is the process from where it starts and where it begins so my subroutine basically is from the sub all the way down to where the end is you don't need anything in the brackets there now the next thing that we need to do first of all is to allocate certain areas where we get to store information now when we were doing this process and I was doing this for example I was saying uh finish and merge edit individual documents from one to one I know how many um how many items are in this data source from one to number 12 okay and I'm this is I know this is my master document here this is the one where I'm actually merging and then once I've done this let's say I'm merging one to one and click OK I know this is my merge document we can see it's merged here I know this because I've got this information let me just close that without saving I store these these bits of information in my head in my brain so I've got the first record is number one I know the last record is number 12. I've got that in a little area in my memory there I know here is this is the master document this is what I can see in front of me right now is the active document this is the master document when I actually merge this and I just put one to one I know now that the active document is what's in front of me now it's this one here it's the merge document I know that I'm going to go here and go to file save as so I've got all these little bits of information stored in my brain somewhere now computers or the program doesn't have this ability it doesn't have its own storage area automatically generated we need to generate those so we create what we call variables and the first one here is called Master dog so I've named this as Master dog and basically in this little memory area I'm going to save a document then I've also created one and what I'm going to save in here actually is going to be the master document so I'm going to store this thing the master document with the merge fields then I've got another variable called single merge Dock and this is also going to save a document again what this is going to do is when I actually finish a merge and edit individual documents I'm only going to merge one this document here that is actual single merge document is going to be saved as my single merge document so it's going to be saved in this variable here okay now the last thing that I want is to also record um how many records what is the last record the number of the last records now I know that there are 12. I keep that in my brain but here if I go to edit recipient list I need to go and count one two three four five six and this is the last record and the last record is number 12. so I need to store this somewhere so that my program knows I'm it's going to repeat this 12 times if I've got 50 items in here it will know to repeated 50 times a thousand a thousand times so let's just close that Okay so let's close that one as well don't save now the next thing that we do is we set the master dock so in this variable Masters dot we put the active document now the active document is this one it's whichever document is in front of you so with this document open in front of me this is the active document and it will have to be this one because if I'm going to merge from this document I'm in this document and I'm simply going to finish a merge up here while I'm inside this document so this is my active document and this is what's going to be saved in merge in master dock in this one here so that active document is going to be the master dock now from that Master document we want to go to the data source and make the active record the last one so what that's doing is it's telling it from this document go to this recipient list and go to the last one down here not the first one initially it will be at the first one up here it's telling it to go to the last one okay and then what it's doing is saying the last record number in other words this variable here last record number equals to so we're going to store whatever record my master document is on the active record now since we've told our active record to go down to the last one it's going to store the number of this last record in this case it would be 12. okay now if we had 15 here then it will be 50 as we've said so basically that process um identifies how many records we're going to merge and it stores that number inside last record number now it then tells the master document data source to make the active record the first one so now what it's doing is telling it from here go back up to the first one because that's where we want to start from when we're going to start merging our documents we can start from the first one and go down to the last one okay now we then have this Loop now this Loop here it starts from here where it says do while and it finishes here where the loop is and it's going to keep looping until this condition here is no longer true so this condition says keep doing all of this as long as the last record number so the variable whatever's inside the variable currently in here we've got the number 12. is bigger than zero and it is because it's 12 okay and you're going to see how we're going to use this to actually Stop the Loop down here later on okay so since last record number is actually equal to 12 it's going to do this first line if it wasn't equal to 12 it would if it was a less than zero or equal to zero it would jump it would not come to this line it would jump to here outside of the loop it will jump here to N Sub and finish the program but since it's 12 it's going to do this first line and it's saying the master document mail merge destination equals to send to new document so from the master dog that's basically telling it to do this we when we go to finish a merge I want to edit individual documents I don't want to print documents and I don't want to send as an email I want this feature and that's basically what that says it's saying use the feature send to new document then it says make the first record equal to so from the master make the first record equal to whatever the active record is now and then here it then says make the last record if we see what this one here make that last record equal to whatever the active record is so the first and last are going to be whatever the active record is well the active record we said currently is pointing to the first one so it's the number one and what that's doing is it's setting here we're not going to finish a merge edit individual document is going to set the first one to one and the last one to one so it's only going to merge up one document and that's what that's doing okay just cancel that so I can go back to my code then it says Master Doc mail merge dot execute Force now that does basically does this so we've gone here edit individual documents we've gone from one to one and that basically means okay so that false property basically means you're clicking on the button here okay and as soon as I do that look it's now merged only one document this document now is the document I can see so it is now the active document this is my active document because this is what's in front now if I was doing this manually I would then go to file save as go to my folder write the file name save it then file save as change it to PDF go to the folder save it so that's what we expect to see in the program now so that's yeah okay so the next part is set single merge dog as the active document so this variable here now is saving the active document and the active document now is the merged document this one single document that was merged we're saving this in single merge document so this these four lines here which is actually one line um but it's got this link down here and this is the process to save the word document and this one is the process to save the PDF so let's have a look at this it says single merge dock well that's that's the merge document this one here use the process save as number two and that is essentially bio save as and we're saving it as a Word document so that's basically saying we're using this one word document here okay now then it says the name of the file that we're going to save it is going to be from the Master Doc mail merge data source go to data fields and find Doc folder so if we look here if I go to my data source you can see it finds doc folder and it sees the path is C merge word docs remember at the beginning when we said that this thing here read only we have these three photos well this is where they come into play this is why it has to be you have to name these things here at the top exactly the same because it's now looking for the field doc folder and it's going to get the path where it's going to save it from this one here for this record okay so if we go back to our program we can see here that it's going to get it from Doc folder if you change this name here because you just want to call it something else then you would have to change this value here to whatever you've changed it to so what this is doing now it's getting that value there linking it with an a path separator so let me show you what that is so it's taking this path here so I'm going to put this here then it's putting a path separator this is actually the path separator that slash so you could concatenate the Slash then it's saying from the Master Doc mail merge data source from the data fields file name now this is where the other property comes in file name get that value so whatever value you've got in file name and Link that to after the pass separator there's a concatenate so concatenate here add the file name which is in the file name field and then concatenate the doc dot docx so what that's doing now is it's put the path separator it's going to file name this one here so for this record it's going to be this one it's going to add that file name Lorena space poems word marksheet and then it concatenates the DOT doc X and it's made this path okay this path here that's where it's saving it to and that's like doing this that's like going to my active sheet which is this one here the merge one file save as browse so I'm doing my path now so here it is I'm going to C drive merge word docs I'm changing the name to uh Lorena Holmes Mark sheet dot doc X and then click save okay so that's what that's doing I'm not going to save that now and let's go back to my code and that's it that would save that document file format WD for my XML document and that's just the formatting for the word document now my single merge document or my merge dock is still the active one so now that I've saved it so let's just do that now that I've saved it it's here the next process is I go to file save as and save it as a PDF so let's go look at the code so then it says single merge dock export find uh export fixed format so here I'm going to choose a different format you can see this one here now it's saying here output file name just like before using whatever is now you're going to go to the folder PDF folder so this time it's going to get the path to this one so if I wanted to put my word document and my PDF documents saved in the same folder then all I would have to do in my code is simply change this here to let's say Doc folder and rename this to dot folder and that will just basically save everything in the same folder okay but I've just chosen to save it in two different folders it's then going to link the file name the file name again is this one here but this path will now change to PDF to merge PDF docs so merge PDF Docs okay because that's what's inside the PDF folder that's its value there and then it will simply add this but it's not going to add the dot dot X it's going to add what does it say value concatenate dot PDF oops let's go there and change it from here Dot PDF okay and that's what that path looks like and then it says export format WD export format PDF so it's going to save it as a PDF document so that one record now that one document that we merged from one to one has been saved as a Word document in the word in the dot folder and as a PDF document in the PDF folder then it says single merge doc Dot close that basically means since this is the one that's opened we've saved it we close it you wouldn't get this message because you would have saved it already I haven't saved this so I'm getting this message I'm just going to click on don't save and I am now back to this window here as my active document because it's closed the other one so this is now my active document let's look at this if else if here is saying if the active record that we were on Now we were on record number one we were doing the first one if that number one is greater or equal to the last record number now remember we saved up here we said that the last record number was the active record when it was the last one so the last report number actually equals to the number 12. one which is the active record is not bigger or equal to the number 12. so this is not going to happen this one here is going to go to else because this is force if it was and we were on the last record number 12 then this will be true and it will say last record number now equals to zero so it's going to change the value of the last record number to zero when it goes back up to the loop here it checks last record number bigger than zero well it wouldn't be because zero is not bigger than zero so it's not going to run this again and it stops the process but for this time we've only done one record so what it does this is not true this statement here so it goes to else and it says master dot mail merge data source active record now equals to the next record which means that the active record now is going to be number two so we were here let's see now go to this one okay and once I do that one it goes back to here and it goes back to the loop because now it says end if so we're going to the next record and if Loop it goes back and it checks what is the last record number with the last record number is still 12 that's bigger than zero so it's going to do all of this again for the active record okay the active record is number two so it's going to go from two to two save it as a word save it as a PDF it's going to check is the active record equal to or bigger than last record number no it's not 2 is not big or equal to 12. so it's going to go here next record next record means it's going to go to this one number three it goes to number three it checks Loop is the last record number bigger than zero yes it is because it's still 12. it's going to keep doing this until it gets to the last one so when we get to the last record let's say we were number 11 it will come to here we'll say go to the next record next record is 12. okay so here 11 is not bigger or equal to last record number because it's 11 is not big or equal to 12. so it would tell it to go to the next record the next record would be number 12. it will then Loop last record is still 12 so it's bigger than zero it would do all of this again save that last record number 12 and now the active record is 12. is that bigger or equal to the last record yes it is it's equal to the last Record 12 is equal to 12. so last record number now will equal zero it will go to Loop is last record number bigger than zero no it's not it's zero so it's not going to do this again and it's going to jump to N Sub and that's it it's finished that is this whole program explained for you I hope you've enjoyed this video tutorial um for those of you that stayed on to see how this program works that's absolutely fine magic I hope you enjoyed it I hope you learned something new I really do hope that you found some use for merging to individualized documents if you do and you'd like this make sure you like make sure you subscribe and guess what I'll see you in the next video now the next video is going to be how we can take a merged document a very large document let's say we've merged all 12 students in one document how we can actually split each student's uh document from that main document into individualized documents very very easily and quickly all right take care see you next video bye-bye
Info
Channel: Nicos Paphitis
Views: 62,547
Rating: undefined out of 5
Keywords: Microsoft Word, education, learning, Mail Merge, import, csv, filter, merge field, document, vb code, module, macro
Id: NVk-XJ_4K8o
Channel Id: undefined
Length: 46min 4sec (2764 seconds)
Published: Mon Nov 21 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.