So cool! Thank you for taking time to put together this video. In case anyone else gets the '5941' error, double-check that you have the column names exactly as described. Took me a while to figure out that I did not, in fact, have them correct!
This is an incredible tutorial!! Not only do you explain each step of the process, you also assume the user may not have certain features displayed, so you provide additional details throughout the process. I am an avid fan of what you're doing!
It's like magic. Had to save & close both the letter & excel list first because i was getting the mentioned '5491' error. Also make sure you added columns are titled correctly. then after reopening and running it works. appreciate it - my team will now think i'm a genius.
The level of gratitude I have for this is indescribable! Oh man, I had been working on this for countless hours and then this! I was initially like please don't make me download 3rd party apps, etc, etc. BUUUTTT THIS! Amazing. Thank you!
OMG one of the most useful & helpful videos I've ever seen in my life! I was despairing this morning thinking about having to individually name 350 PDF files. And then discovered this! I can't thank you enough, not just for doing the video & supplying the macro, but for the fantastic way you explained it all & took us through what to do. A true leader & educator! THANK YOU!💥👋🙏🏅🏆
Just what I was looking for, a million thank you's for your work and code, saving me so much time at work, and for being so generous in providing the mac code as well!
I cannot explain in words how useful this video has been for me. This has saved me hours of work and heartache, thank you so much. And so beautifully explained, thank you.
I can't even begin to tell you how helpful this has been. I've been searching the internet like crazy, and everything I found required me to download another piece of software (which I can't do as I don't have administrator rights on my work computer). I was able to sit back and watch my computer handle the approx 750 mail merged documents with ease. I can't even tell you how amazing this is. Thank you, thank you thank you. And an extra thank you for walking through the macro line by line so I knew there wasn't any "funny business" in there. LOL.
This is amazing. I have no experience of Macros, and this allowed me to do exactly what I needed to do, and has saved me so much time. The instruction was really clear and simple. Thank you very much!
THANK YOU! THANK YOU! THANK YOU! You've saved me hours and hours of tedious work . Your instructions were clear, concise and thorough. I was skeptical that this would require almost as much effort as creating merge files one by one. In the end it was very simple to implement.
Great video - thanks for sharing for free! I eliminated the single word file saving to only generate the PDFs with your in depth explanation, so thankful for this!
You are a saint! I've been fighting with an older marco for over 3 hours trying to get it to work. Now I have what I need to finish those annoying tax receipt mail outs! Thank you!!
Hello, This is Leela from India. A big thank you for your help and support , Your a life saver :-) your easy step by step video , saved my life , I was struggling to save 100 letters , the instructions were so easy - even the copying of the macros from your website was easy.
This is the coolest freaking thing ever. It's something that works so seamlessly that it feels like it should be a native feature in Word's merge mail. Awesome job. Thank you.
Thanks so much!! This code and video are life savers! As a non-coder, the explanations were well thought through and easy to follow. I appreciate you :)
Sir, your code will save many lives and many hours. This is exactly what I was looking for and you explained it exceptionally well. Thank you so much for your generosity!
This is FANTASTIC!!! Just saved me hours of renaming individually!! THANKS SO MUCH!! Took me about 30mins to setup and now I'm off and running!! Thanks!
we got this to work after a few failed attempts and found that we were missing an = sign in one of the columns of the excel spread sheet this has changed our world in terms of workload. thanks guys.
Wow, you, sir, are an absolute genius. This is such an amazing time saver. Thank you for the step by step explanation and for making the macro available. Definitely a channel I will subscribe to.
Hi, the first word file was create and then it ran into an error Run-time error'5941': The requested number of the collection does not exist. Help! It's ok. I read some of your replies to others who had this issues. The column headers were not named correctly. Thank you for sharing the macro. It worked liked magic!!
This is very well explained training! Break it down very nicely to understand and use it. Thank you and appreciate it. I would like to watch other training you have on youtube...Have a great day!
This is the first time that I've ever posted a review. This tutorial is amazing. I followed the process expecting it to fail but it worked perfectly! Thank you for saving me hours of work. Very much appreciated!
many videos i watched that mail merge just make all participants certificate in 1 file, this is realy helping me to make each pdf participants certificate
OMG I just danced & jumped around the office. I just did 585 construction log records in 45 minutes!!! Just splitting the files and renaming woukd have taken me a week. Thanks, Thanks Thanks
I am so glad that this tutorial is still available! It saved me tons of work hours by allowing me merge and save countless docs to pdf files instead creating them one by one. Thank you for sharing your expertise and for making the process so simple.
Wow! Not only are this tutorial and resources really helpful, but also the neatness with which the macros codes are written is simply beautiful! Thank you!
THANK YOUU!! I used a different tutorial that required you to write the macro as they didn't provide it. While it worked, it took a very long time to produce the results. This worked for my ~100 files. THANK YOU
Fantastic! This macro just saved probably 20 hours of work trying to do this one by one. Thank you! The video is very well done, easy to follow and excellent teaching skills
I cannot thank you enough!! 1214 documents that I would have had to manually change the file name on and move to specific folders - you saved me SOOOO much time! Subscribing and going to watch all your videos and watch all the way through the ads so you can get credit for the watch time etc. - being a content creator, I know those things can help with income :)
@@Imnoss Do you have similar video but 1 file pdf has multiple pages. For example: I sent certificates to the employees of the same company, i only sent it to one PIC, and one file pdf containing multiple certificates.
TNice tutorials was a fantastic beginner's guide, straight to the point, very clear. As a long-ti teacher I can tell you are quite apt at teacNice tutorialng!
Thank you so much . I am using office 365. It worked after the run time error 5152. In attempting to get the DocFile name I also noticed that text on my reference cell had the slash (/) sign in it and after running the macros it stop before the cell that had the Slash sign in it. I removed all the slash sign in the text of my referenced cell and it finally worked fully .🙏
This is an AMAZING tutorial. I have been watching youtube coding videos for years. This is by FAR the best one out there. Great job and thank you for making it. It is exactly what I needed, clearly described and will help me tremendously.
hi, just want to say thank you. instead of subscribe adobe pdf pro version or take the risk to upload the confidential pdf to online pdf splitter, this just works!
This was an amazing tutorial. I have to create hundreds of separate documents and our IT team blocked the previous word add-in for security concerns. This was so clear and easy and even better it worked perfectly the first time. A very well designed piece of VB code, thank you so much!
Exactly what I was looking for! I have to make individualized reports for my students. 8 minutes of this video saved me an hour's slog I have to do several times a year. Thanks!
Works great. I was having a problem because I left the mail merge wizard open when I tried to execute the macro, but once I closed it this worked really well. Thanks
hey can I ask what edit you made please? I ran the macro and it's only giving me the last doc and pdf. I've got about 60 documents to make but it's only producing the last one.
Thank you so much for the clear explination and saving me a lot of work splitting up 120 documents into Word and PDF format. You are the hero of the day :-)!
This is beyond amazing ! At first , i thought its impossible , but i just thought that i should at least give it a try ! and trust me , i cannot thank you enough for this . This indeed was a life saver !
I’ve been using this over the last week to create and send out approximately 6000 letters and emails. The VB engine in this example, and in the example from your other video works absolutely perfectly and save me and my team are lots of time. The only issue that arose was with the wild cards used in the V look up. In some cases, the wild cards may need to be customised so that they can differentiate between individuals with the same name. What I had to do, was to include the date of birth as part of the wild card, so that there was more than just a name to select from.
This was a lifesaver!! Thanks for sharing this video AND the code! I did end up having to use the numerical value associated with the file format in order to get it to work.
Thanks so much for this tutorial, used it successfully today to help work through a problem that was otherwise going to require a lot of manual work to achieve
Holy moly. Thank you so much for this! I just had to clean up my spreadsheet for 5 variations of letters we had, but after that, it was so quick using your macro! Saved a lot of time. Thanks again!
This is AWESOME! Million thanks Imnoss! I had a problem in the beginning, the data for naming the files contain characters that cannot be used for file names in windows. After I changed the naming system, it worked! Really impressed! Thanks for your generosity in sharing this. As the saying goes, may kindness begets kindness!
@@albertuserwinsusanto924 I'm sure my folder path is correct. Did you use this Code : Sub MailMergeToPdfBasic() ' Mark the start of the Subroutine (i.e. Macro) and name it "MailMergeToPdf" ' Macro created by Imnoss Ltd ' Please share freely while retaining attribution ' Last Updated 2021-05-03 Dim masterDoc As Document, singleDoc As Document, lastRecordNum As Integer ' Create variables ("Post-it Notes") for later use Set masterDoc = ActiveDocument ' Identify the ActiveDocument (foremost doc when Macro run) as "masterDoc" masterDoc.MailMerge.DataSource.ActiveRecord = wdLastRecord ' jump to the last active record (active = ticked in edit recipients) lastRecordNum = masterDoc.MailMerge.DataSource.ActiveRecord ' retrieve the record number of the last active record so we know when to stop masterDoc.MailMerge.DataSource.ActiveRecord = wdFirstRecord ' jump to the first active record (active = ticked in edit recipients) Do While lastRecordNum > 0 ' create a loop, lastRecordNum is used to end the loop by setting to zero (see below) masterDoc.MailMerge.Destination = wdSendToNewDocument ' Identify that we are creating a word docx (and no e.g. an email) masterDoc.MailMerge.DataSource.FirstRecord = masterDoc.MailMerge.DataSource.ActiveRecord ' Limit the selection to just one document by setting the start ... masterDoc.MailMerge.DataSource.LastRecord = masterDoc.MailMerge.DataSource.ActiveRecord ' ... and end points to the active record masterDoc.MailMerge.Execute False ' run the MailMerge based on the above settings (i.e. for one record) Set singleDoc = ActiveDocument ' Identify the ActiveDocument (foremost doc after running the MailMerge) as "singleDoc" singleDoc.SaveAs2 _ FileName:=masterDoc.MailMerge.DataSource.DataFields("DocFolderPath").Value & Application.PathSeparator & _ masterDoc.MailMerge.DataSource.DataFields("DocFileName").Value & ".docx", _ FileFormat:=wdFormatXMLDocument ' Save "singleDoc" as a word docx with the details provided in the DocFolderPath and DocFileName fields in the MailMerge data singleDoc.ExportAsFixedFormat _ OutputFileName:=masterDoc.MailMerge.DataSource.DataFields("PdfFolderPath").Value & Application.PathSeparator & _ masterDoc.MailMerge.DataSource.DataFields("PdfFileName").Value & ".pdf", _ ExportFormat:=wdExportFormatPDF ' Export "singleDoc" as a PDF with the details provided in the PdfFolderPath and PdfFileName fields in the MailMerge data singleDoc.Close False ' Close "singleDoc", the variable "singleDoc" can now be used for the next record when created If masterDoc.MailMerge.DataSource.ActiveRecord >= lastRecordNum Then ' test if we have just created a document for the last record lastRecordNum = 0 ' if so we set lastRecordNum to zero to indicate that the loop should end Else masterDoc.MailMerge.DataSource.ActiveRecord = wdNextRecord ' otherwise go to the next active record End If Loop ' loop back to the Do start End Sub ' Mark the end of the Subroutine
This seems incredible, but is not working for me. Can someone PLEASE help??? I am getting run time error 5941 "The requested member of collection does not exist." When I debug, this line is highlighted: singleDoc.SaveAs2 _ FileName:=masterDoc.MailMerge.DataSource.DataFields("DocFolderPath").Value & Application.PathSeparator & _ masterDoc.MailMerge.DataSource.DataFields("DocFileName").Value & ".docx", _ FileFormat:=wdFormatXMLDocument ' Save "singleDoc" as a word docx with the details provided in the DocFolderPath and DocFileName fields in the MailMerge data I am desperate.
Thank you for this wonderful tutorial. Not only is it a very effective macro, the way you have documented and explained it empowers the user to tweak it even more. Great job.
This is AWESOME! Thank you for having created this video and for making the macro available for copy/paste. It was really , really simple to implement and it worked right away. Thank you!!!
Imnoss, this is an incredible idea. You are amazing. Thank you! The step-by-step explanation makes life so easy. I am following and subscribing right-away.
Amazing solution using a macro within MS Word! And thanks a lot for sharing your knowledge in such a clear and detailed way with this wonderful tutorial. This is very useful indeed!
This was awesome!! Thank you. I could not get the VBA to work from the Word Mail Merge Document on-line, but I wrote the VBA from your UA-cam video and it worked like a charm. Thank you:)
I am so grateful for this video, it has saved me so much time and I was looking for a video on how to do custom file names for ages, so glad I found this! Massive thank you!
Hi Tarni, this is one of those crazy issues where so much time can be wasted. If you have any questions, please feel free to ask them here or via the website (imnoss.com/#contact).
So cool! Thank you for taking time to put together this video.
In case anyone else gets the '5941' error, double-check that you have the column names exactly as described. Took me a while to figure out that I did not, in fact, have them correct!
Thanks for the heads up about the '5941' error.
Aaaah thank you! i spent WAY too long stumped on this.
OMG, thank you!! The 5941 error was driving me crazy and like you I was sure I had it correct, but had spelt PDf instead of Pdf.
@@nzoutdoors1923 thanks for the spelling check post
You've saved me from a nervous breakdown today! What a great tutorial.
I actually shed a tear of joy watching this work the first time. Thank you so, so much!
Glad it helped!
Need mail merge? BRILLIANT VIDEO! Step by step explanation makes this process super easy, even for someone like me with limited skills. Thank you!
This is an incredible tutorial!! Not only do you explain each step of the process, you also assume the user may not have certain features displayed, so you provide additional details throughout the process. I am an avid fan of what you're doing!
It's like magic. Had to save & close both the letter & excel list first because i was getting the mentioned '5491' error. Also make sure you added columns are titled correctly. then after reopening and running it works. appreciate it - my team will now think i'm a genius.
The level of gratitude I have for this is indescribable! Oh man, I had been working on this for countless hours and then this! I was initially like please don't make me download 3rd party apps, etc, etc. BUUUTTT THIS! Amazing. Thank you!
Good 23 mins of my life spent into learning a kickass thing. Crisp and to the point. Kudos!
thank you :)
Can you share VBA code here ?
@@sifatullah8071 , you need to write your own. :)
Paste once you're done, I can help with troubleshooting.
Thank you so much!!! This just saved me from separating 114 documents. You are a life saver!
Thank you, I hope it continues to be useful.
OMG one of the most useful & helpful videos I've ever seen in my life! I was despairing this morning thinking about having to individually name 350 PDF files. And then discovered this! I can't thank you enough, not just for doing the video & supplying the macro, but for the fantastic way you explained it all & took us through what to do. A true leader & educator! THANK YOU!💥👋🙏🏅🏆
Just what I was looking for, a million thank you's for your work and code, saving me so much time at work, and for being so generous in providing the mac code as well!
Nice work! I have 30+ years of experience programming macros, and this code gave me excellent direction. Thanks!
Glad it helped!
I cannot explain in words how useful this video has been for me. This has saved me hours of work and heartache, thank you so much. And so beautifully explained, thank you.
I can't even begin to tell you how helpful this has been. I've been searching the internet like crazy, and everything I found required me to download another piece of software (which I can't do as I don't have administrator rights on my work computer). I was able to sit back and watch my computer handle the approx 750 mail merged documents with ease. I can't even tell you how amazing this is. Thank you, thank you thank you. And an extra thank you for walking through the macro line by line so I knew there wasn't any "funny business" in there. LOL.
thank you :)
This is amazing. I have no experience of Macros, and this allowed me to do exactly what I needed to do, and has saved me so much time. The instruction was really clear and simple. Thank you very much!
I feel like a genius, I used a visual basic macro! Thank you for saving me from hours of tedium.
THANK YOU! THANK YOU! THANK YOU! You've saved me hours and hours of tedious work . Your instructions were clear, concise and thorough. I was skeptical that this would require almost as much effort as creating merge files one by one. In the end it was very simple to implement.
You're welcome.
Great video - thanks for sharing for free! I eliminated the single word file saving to only generate the PDFs with your in depth explanation, so thankful for this!
You Sir are a hero. Cannot thank you enough for sharing your macro and taking the time to demonstrate it!
You are a saint! I've been fighting with an older marco for over 3 hours trying to get it to work. Now I have what I need to finish those annoying tax receipt mail outs! Thank you!!
Glad I could help
Honestly once explained it's fairly intuitive. Thank you for breaking it down so nicely for us newbies! Can't wait to play with the full version
Hello,
This is Leela from India. A big thank you for your help and support , Your a life saver :-) your easy step by step video , saved my life , I was struggling to save 100 letters , the instructions were so easy - even the copying of the macros from your website was easy.
Hi Leela, thank you so much, I really appreciate the positive feedback :)
This is the coolest freaking thing ever. It's something that works so seamlessly that it feels like it should be a native feature in Word's merge mail. Awesome job. Thank you.
thank you :)
I did a mini dance when I ran the script! you saved me an enter day on mail merging 102 documents
Thanks so much!! This code and video are life savers! As a non-coder, the explanations were well thought through and easy to follow. I appreciate you :)
You're welcome!
Thank you! Data set is ~1500, and the test run yesterday was a success! Sincere thanks from Dallas, Texas.
You're welcome Kalyse, Great to hear!
Sir, your code will save many lives and many hours. This is exactly what I was looking for and you explained it exceptionally well. Thank you so much for your generosity!
You are most welcome
This is FANTASTIC!!! Just saved me hours of renaming individually!! THANKS SO MUCH!! Took me about 30mins to setup and now I'm off and running!! Thanks!
OMG this just saved me from having to manually sort 600 files. ID KISS YOU IF I COULD.
+1
Me too available for kiss
we got this to work after a few failed attempts and found that we were missing an = sign in one of the columns of the excel spread sheet this has changed our world in terms of workload. thanks guys.
You are most welcome.
Thank you so much! This save my day and the walkthrough is at a very good pace too! Not a second wasted! Brilliant work!
Wow, you, sir, are an absolute genius. This is such an amazing time saver. Thank you for the step by step explanation and for making the macro available. Definitely a channel I will subscribe to.
Hi, the first word file was create and then it ran into an error Run-time error'5941': The requested number of the collection does not exist. Help! It's ok. I read some of your replies to others who had this issues. The column headers were not named correctly. Thank you for sharing the macro. It worked liked magic!!
This is very well explained training! Break it down very nicely to understand and use it. Thank you and appreciate it. I would like to watch other training you have on youtube...Have a great day!
I'm stunned about how robust and easy this is...thank you thank you!
WOW THIS IS AMAZING!! If only I had found this video years ago. My job makes me save hundreds of files one-by-one. Not anymore thanks to this macro!!
i had this setup by my colleague some years back, but now this video helped me to setup the same without my colleague helps.. thank you..
This is the first time that I've ever posted a review. This tutorial is amazing. I followed the process expecting it to fail but it worked perfectly! Thank you for saving me hours of work. Very much appreciated!
many videos i watched that mail merge just make all participants certificate in 1 file, this is realy helping me to make each pdf participants certificate
OMG I just danced & jumped around the office. I just did 585 construction log records in 45 minutes!!! Just splitting the files and renaming woukd have taken me a week. Thanks, Thanks Thanks
I am so glad that this tutorial is still available! It saved me tons of work hours by allowing me merge and save countless docs to pdf files instead creating them one by one. Thank you for sharing your expertise and for making the process so simple.
Wow! Not only are this tutorial and resources really helpful, but also the neatness with which the macros codes are written is simply beautiful! Thank you!
Glad it was helpful!
FINALLY!! Thank you for this simple, straightforward, and time-saving solution!
you are brilliant! Thank you! You just saved us having to manually name over 4000 documents for a mail merge!
THANK YOUU!! I used a different tutorial that required you to write the macro as they didn't provide it. While it worked, it took a very long time to produce the results. This worked for my ~100 files. THANK YOU
Fantastic! This macro just saved probably 20 hours of work trying to do this one by one. Thank you! The video is very well done, easy to follow and excellent teaching skills
This is one of the best tech videos I have ever seen on UA-cam and exactly what I needed. Great teaching right here.
I cannot thank you enough!! 1214 documents that I would have had to manually change the file name on and move to specific folders - you saved me SOOOO much time! Subscribing and going to watch all your videos and watch all the way through the ads so you can get credit for the watch time etc. - being a content creator, I know those things can help with income :)
You're welcome!
@@Imnoss Do you have similar video but 1 file pdf has multiple pages. For example: I sent certificates to the employees of the same company, i only sent it to one PIC, and one file pdf containing multiple certificates.
This is magic, thanks!!!! As I have my Word configured in Spanish, I thought the code would not work... but it did!!!
You saved my life today, this video is amazing and my job is forever changed!!!!
You are most welcome.
You just saved me from copy/paste super repetitive informations in multiples files for hours. Thank you so much
TNice tutorials was a fantastic beginner's guide, straight to the point, very clear. As a long-ti teacher I can tell you are quite apt at teacNice tutorialng!
thank you
Thank you so much . I am using office 365. It worked after the run time error 5152. In attempting to get the DocFile name I also noticed that text on my reference cell had the slash (/) sign in it and after running the macros it stop before the cell that had the Slash sign in it. I removed all the slash sign in the text of my referenced cell and it finally worked fully .🙏
This is an AMAZING tutorial. I have been watching youtube coding videos for years. This is by FAR the best one out there. Great job and thank you for making it. It is exactly what I needed, clearly described and will help me tremendously.
hi, just want to say thank you.
instead of subscribe adobe pdf pro version or take the risk to upload the confidential pdf to online pdf splitter, this just works!
thank you Jeff, if you have any requests or suggestions for other content, do let me know.
i don't usually comment, but a thank you is not enough really. much appreciated
THANK YOU MY BROTHER FROM ANOTHER COUNTRY AND ANOTHER FAMILY!!!
Thank You for sharing this !!!!!!!!! Save my day when creating multiple online certificates
This was an amazing tutorial. I have to create hundreds of separate documents and our IT team blocked the previous word add-in for security concerns. This was so clear and easy and even better it worked perfectly the first time. A very well designed piece of VB code, thank you so much!
Exactly what I was looking for! I have to make individualized reports for my students. 8 minutes of this video saved me an hour's slog I have to do several times a year. Thanks!
Works great. I was having a problem because I left the mail merge wizard open when I tried to execute the macro, but once I closed it this worked really well. Thanks
I had to make an edit for some reason to the code but it actually did work. Thanks for this!
hey can I ask what edit you made please? I ran the macro and it's only giving me the last doc and pdf. I've got about 60 documents to make but it's only producing the last one.
Thank you so much for the clear explination and saving me a lot of work splitting up 120 documents into Word and PDF format. You are the hero of the day :-)!
This is beyond amazing ! At first , i thought its impossible , but i just thought that i should at least give it a try ! and trust me , i cannot thank you enough for this .
This indeed was a life saver !
I’ve been using this over the last week to create and send out approximately 6000 letters and emails. The VB engine in this example, and in the example from your other video works absolutely perfectly and save me and my team are lots of time. The only issue that arose was with the wild cards used in the V look up. In some cases, the wild cards may need to be customised so that they can differentiate between individuals with the same name. What I had to do, was to include the date of birth as part of the wild card, so that there was more than just a name to select from.
This was a lifesaver!! Thanks for sharing this video AND the code! I did end up having to use the numerical value associated with the file format in order to get it to work.
Works like a charm! And I'm no macro expert at all! Thank you for sharing!
WOW, WOW, WOW..... THANK YOU! I really can't believe this worked for me, and I am thrilled with how much time I will save.
Thanks so much for this tutorial, used it successfully today to help work through a problem that was otherwise going to require a lot of manual work to achieve
Holy moly. Thank you so much for this! I just had to clean up my spreadsheet for 5 variations of letters we had, but after that, it was so quick using your macro! Saved a lot of time. Thanks again!
Thanks! Been looking for hours for a solution and with this macro it is done in a couple of minutes, huge life saver!
This is AWESOME! Million thanks Imnoss!
I had a problem in the beginning, the data for naming the files contain characters that cannot be used for file names in windows. After I changed the naming system, it worked! Really impressed! Thanks for your generosity in sharing this. As the saying goes, may kindness begets kindness!
Hello. Can you send me the text of the macro you used as the one provided on their website is not working
@@imentoukabri6726 it works. I didn't change the Macro code. Just make sure you make the folder path right.
@@albertuserwinsusanto924 I'm sure my folder path is correct. Did you use this Code : Sub MailMergeToPdfBasic() ' Mark the start of the Subroutine (i.e. Macro) and name it "MailMergeToPdf"
' Macro created by Imnoss Ltd
' Please share freely while retaining attribution
' Last Updated 2021-05-03
Dim masterDoc As Document, singleDoc As Document, lastRecordNum As Integer ' Create variables ("Post-it Notes") for later use
Set masterDoc = ActiveDocument ' Identify the ActiveDocument (foremost doc when Macro run) as "masterDoc"
masterDoc.MailMerge.DataSource.ActiveRecord = wdLastRecord ' jump to the last active record (active = ticked in edit recipients)
lastRecordNum = masterDoc.MailMerge.DataSource.ActiveRecord ' retrieve the record number of the last active record so we know when to stop
masterDoc.MailMerge.DataSource.ActiveRecord = wdFirstRecord ' jump to the first active record (active = ticked in edit recipients)
Do While lastRecordNum > 0 ' create a loop, lastRecordNum is used to end the loop by setting to zero (see below)
masterDoc.MailMerge.Destination = wdSendToNewDocument ' Identify that we are creating a word docx (and no e.g. an email)
masterDoc.MailMerge.DataSource.FirstRecord = masterDoc.MailMerge.DataSource.ActiveRecord ' Limit the selection to just one document by setting the start ...
masterDoc.MailMerge.DataSource.LastRecord = masterDoc.MailMerge.DataSource.ActiveRecord ' ... and end points to the active record
masterDoc.MailMerge.Execute False ' run the MailMerge based on the above settings (i.e. for one record)
Set singleDoc = ActiveDocument ' Identify the ActiveDocument (foremost doc after running the MailMerge) as "singleDoc"
singleDoc.SaveAs2 _
FileName:=masterDoc.MailMerge.DataSource.DataFields("DocFolderPath").Value & Application.PathSeparator & _
masterDoc.MailMerge.DataSource.DataFields("DocFileName").Value & ".docx", _
FileFormat:=wdFormatXMLDocument ' Save "singleDoc" as a word docx with the details provided in the DocFolderPath and DocFileName fields in the MailMerge data
singleDoc.ExportAsFixedFormat _
OutputFileName:=masterDoc.MailMerge.DataSource.DataFields("PdfFolderPath").Value & Application.PathSeparator & _
masterDoc.MailMerge.DataSource.DataFields("PdfFileName").Value & ".pdf", _
ExportFormat:=wdExportFormatPDF ' Export "singleDoc" as a PDF with the details provided in the PdfFolderPath and PdfFileName fields in the MailMerge data
singleDoc.Close False ' Close "singleDoc", the variable "singleDoc" can now be used for the next record when created
If masterDoc.MailMerge.DataSource.ActiveRecord >= lastRecordNum Then ' test if we have just created a document for the last record
lastRecordNum = 0 ' if so we set lastRecordNum to zero to indicate that the loop should end
Else
masterDoc.MailMerge.DataSource.ActiveRecord = wdNextRecord ' otherwise go to the next active record
End If
Loop ' loop back to the Do start
End Sub ' Mark the end of the Subroutine
Thanks a lot this video saves my hours of copy paste work .....this is what I am searching from last year .....thank you very much
This seems incredible, but is not working for me. Can someone PLEASE help??? I am getting run time error 5941 "The requested member of collection does not exist." When I debug, this line is highlighted:
singleDoc.SaveAs2 _
FileName:=masterDoc.MailMerge.DataSource.DataFields("DocFolderPath").Value & Application.PathSeparator & _
masterDoc.MailMerge.DataSource.DataFields("DocFileName").Value & ".docx", _
FileFormat:=wdFormatXMLDocument ' Save "singleDoc" as a word docx with the details provided in the DocFolderPath and DocFileName fields in the MailMerge data
I am desperate.
Thank you for this wonderful tutorial. Not only is it a very effective macro, the way you have documented and explained it empowers the user to tweak it even more. Great job.
Thank you for making my job easier. It worked like a charm.
Thank you very much, the world needs more people like you 😍
This is AWESOME! Thank you for having created this video and for making the macro available for copy/paste. It was really , really simple to implement and it worked right away. Thank you!!!
THANK YOU SO MUCH! This was a lifesaver. My first time using macros and I was able to follow along and saved a huge amount of time.
I found the filter option in the Word mail merge functionality, and that works for my need!
Imnoss, this is an incredible idea. You are amazing. Thank you! The step-by-step explanation makes life so easy. I am following and subscribing right-away.
Wow! Thank you for this! I was able to figure it out and feel powerful!
GENIUS... absolute genius!!! You made my work day/week/month/year!!! OMG so awesome!!! Thank you!!!
I've seen that has actually explained it to in a concise way!
thanks!
Amazing solution using a macro within MS Word! And thanks a lot for sharing your knowledge in such a clear and detailed way with this wonderful tutorial. This is very useful indeed!
This is amazing. Great solution, great clear, easy to understand video for the lay-man/person, great outcome! BRAVO!
Thank you very much!
Such a life saver! I am so grateful..Working From Home this comes really handy
This was awesome!! Thank you. I could not get the VBA to work from the Word Mail Merge Document on-line, but I wrote the VBA from your UA-cam video and it worked like a charm. Thank you:)
One of the clearest tutorials i've seen. Nicely done!
I am so grateful for this video, it has saved me so much time and I was looking for a video on how to do custom file names for ages, so glad I found this! Massive thank you!
Hi Tarni, this is one of those crazy issues where so much time can be wasted. If you have any questions, please feel free to ask them here or via the website (imnoss.com/#contact).
Thank you so much working like a charm i was just in need of pdfs hence removed word doc part ❤️😍
I have no word for your excellent work. Thank you so much
Amazing simple tutorial. You have save me hours. Thank you so much. I don't understand why Word doesn't have this feature built in.
This is a huge help!
Please keep up the good work :)
Do take a session on Marcos if possible. Your explanation is so simple to understand!
You are a GENIUS!!!!!! Thank you so much for this video!! Saved hours of work renaming files!!!!
Thank you so much...for this code using I have saved 1 hrs on the job time..& now I am doing within 2 Mnt.
Well-designed video, it is simple and complete. Congrats and thank you 👍
This video is a life-saver - it has genuinely helped me so much. Thank you
Thank you so much! I can not wait to start setuping. I want to create original soft for comrcials and shows alongside my many other
This has been a life saver - thank you - saved me hours of copying/pasting/saving
You're welcome :)