Use Excel data to populate a template in Word

  Рет қаралды 95,724

Barb Henderson

Barb Henderson

Жыл бұрын

Use Excel data to populate a template in Word. Create form letters from data listed in Excel. Check out my free templates and templates with code are available for purchase for $50 USD
www.easyexcelanswers.com/temp...
Check out my online training www.easyexcelanswers.com/courses.html
Are you struggling to update your Microsoft SQL Server data?
I recommend using well-known Excel to update and manage your data in SQL Server using the SQL Spreads Excel add-in.
Click sqlspreads.com/?pid=barbhende... to find out how SQL Spreads works best for non-technical end users and download our free 14-day trial. You will get two months free when purchasing an annual subscription using our link.
For more help visit my website www.easyexcelanswers.com or email me at easyexcelanswers@gmail.com.
Contact me regarding customizing this template for your needs.
Click for online Excel Consulting www.calendly.com/easyexcelanswers
I am able to provide online help on your computer at a reasonable rate.
www.amazon.com/shop/barbhende...
I use a Blue condenser Microphone to record my videos, here is the link
amzn.to/37gyyGa
Check out Crowdcast for creating your webinars
app.linkmink.com/a/crowdcast/83
If you need to buy Office 2019 follow
amzn.to/2VX5dv8
I use Tube Buddy to help promote my videos
Check them out
www.Tubebuddy.com/easyexcelan...
Follow me on Facebook
/ easyexcel.answers
TWEET THIS VIDEO • Use Excel data to popu...
Follow me on twitter
easyexcelanswers
IG @barbhendersonconsulting
You can help and generate a translation to you own language
kzbin.info_cs_p...
*this description may contain affiliate links. When you click them, I may receive a small commission at no extra cost to you. I only recommend products and services that I've used or have experience with.
templates including code are available for $50 USD
How to insert VBA code in Excel
• How to insert VBA code...
code
Sub ReplaceText()
Dim wApp As Word.Application
Dim wdoc As Word.Document
Dim custN, path As String
Dim r As Long
r = 2
Do While Sheet1.Cells(r, 1) (not equal to) ""
Set wApp = CreateObject("Word.Application")
wApp.Visible = True
Set wdoc = wApp.Documents.Open(Filename:="C:\Users\screa\OneDrive
econstructionBH\Documents\Excel\welcome.dotx", ReadOnly:=True)
With wdoc
.Application.Selection.Find.Text = "||name||"
.Application.Selection.Find.Execute
.Application.Selection = Sheet1.Cells(r, 1).Value
.Application.Selection.EndOf
.Application.Selection.Find.Text = "||address||"
.Application.Selection.Find.Execute
.Application.Selection = Sheet1.Cells(r, 2).Value
.Application.Selection.EndOf
.Application.Selection.Find.Text = "||city||"
.Application.Selection.Find.Execute
.Application.Selection = Sheet1.Cells(r, 3).Value
.Application.Selection.EndOf
.Application.Selection.Find.Text = "||postal code||"
.Application.Selection.Find.Execute
.Application.Selection = Sheet1.Cells(r, 4).Value
.Application.Selection.EndOf
.Application.Selection.Find.Text = "||name||"
.Application.Selection.Find.Execute
.Application.Selection = Sheet1.Cells(r, 1).Value
.Application.Selection.EndOf
custN = Sheet1.Cells(r, 1).Value
path = "C:\Users\screa\OneDrive\Desktop\invoices\"
.SaveAs2 Filename:=path & custN, _
FileFormat:=wdFormatXMLDocument, AddtoRecentFiles:=False
End With
r = r + 1
Loop
End Sub

Пікірлер: 130
@BarbHendersonconsulting
@BarbHendersonconsulting Жыл бұрын
thank you for watching my video. Because I am not able to put square brackets in the description of video, I have replaced the with ||field_name|| in the code in the description.
@ColoradoOrion
@ColoradoOrion 6 ай бұрын
FYI, these are technically "angle brackets". Square brackets are on the same keys as the curly braces { }.
@jerryhamilton1150
@jerryhamilton1150 3 ай бұрын
Good Example. I noticed where you had a second instance to replace the same text that you put in a second set of code for the next instance. Could you not use a replace all to replace all instances of the same text?
@SpotlightImpact
@SpotlightImpact Жыл бұрын
This is cool Barb! Can't wait to try this out!
@BarbHendersonconsulting
@BarbHendersonconsulting Жыл бұрын
thank you
@drallisimo34
@drallisimo34 4 ай бұрын
very useful tutorial.thank you!
@BarbHendersonconsulting
@BarbHendersonconsulting 4 ай бұрын
Glad it was helpful!
@crafty_tams
@crafty_tams Жыл бұрын
Thanks for sharing, that’s brilliant
@BarbHendersonconsulting
@BarbHendersonconsulting Жыл бұрын
Glad you enjoyed it
@bakesmash882
@bakesmash882 Жыл бұрын
Very helpful! Trying to crack the code on loading an image now 🎉 Ty for the video
@BarbHendersonconsulting
@BarbHendersonconsulting Жыл бұрын
I am glad you like it!
@Didjamama
@Didjamama Жыл бұрын
Hey Barb excellent tutorial I got everything running great based off this and added a few line to add more data point! The problem I can't seem to solve is with taking the number formatted as accounting or currency in Excel but it displays as a generic number in Word. I've played (trial and error) with NumberFormat = but I can't seem to tackle this. Any suggestions on what I should research to resolve?
@BarbHendersonconsulting
@BarbHendersonconsulting Жыл бұрын
I did a quick search and came up with "Format(123123, "Currency")" .So I think that you would select the field and then apply that command. Good luck
@helderlopes6715
@helderlopes6715 10 ай бұрын
Thanks Barb. Your solution is working just fine! Do you know how to populate fields on headers? It seems to work only if the fields are included in the main body of the Word Template.
@BarbHendersonconsulting
@BarbHendersonconsulting 10 ай бұрын
I have never tried to populate the header!
@user-rs9ws5df5c
@user-rs9ws5df5c Жыл бұрын
Thank you for the video! I have an issue where when I used the code to create the saved documents with the merge fields, the merged information is not in the correct location and the merge field names are still present (the info i wanted shows at top of page and merge field names are still in table). The preview in the template works fine, but the saved documents are incorrect. Any suggestions?
@BarbHendersonconsulting
@BarbHendersonconsulting Жыл бұрын
If the template works fine, try again
@MichaelMinder
@MichaelMinder Жыл бұрын
Hi Barb! Great video! Very instructive and broken down and explained very carefully. When trying to run the macro, I seem to be getting a "Compile error: user-defined type not defined" for the the line of code reading "Do while Sheet1.Cells(r, 1) (not equl to)""....What could I be doing wrong. Need your guidance. Thanks.
@BarbHendersonconsulting
@BarbHendersonconsulting Жыл бұрын
I am not able to place symbols in the description of the video. the command should read do while sheet1.cells(r,1) ""
@alexen88
@alexen88 Жыл бұрын
@@BarbHendersonconsulting Hi Barb, I am still getting "run-time error:'424': Object required" when i add the command. Any help/Tips/clearification?
@TBoy205
@TBoy205 Жыл бұрын
@@BarbHendersonconsulting Maybe post the code to a site like pastebin instead of in the description?
@beckyjanefox
@beckyjanefox Жыл бұрын
Hi Barb! This is great thanks. Would it also work to take data from Excel and put it into a formatted table in word?
@BarbHendersonconsulting
@BarbHendersonconsulting Жыл бұрын
Yes, absolutely, Check out this video kzbin.info/www/bejne/havMiYGpZZhrrsU
@dfrzrdfrzr
@dfrzrdfrzr Жыл бұрын
This has been EXTREMELY helpful! Thank you. I am looking to create if logic based on information within the cell - do you have any examples? For example: If the cell has "blocking issues: 1" write BLOCKED on the word template.
@BarbHendersonconsulting
@BarbHendersonconsulting Жыл бұрын
No, sorry. You would have to include an "if" function of some kind
@user-tx6fl9os2s
@user-tx6fl9os2s Жыл бұрын
Great video. Just seeing where I find the codes you mentioned
@BarbHendersonconsulting
@BarbHendersonconsulting Жыл бұрын
In the description, toward the end
@bbigboy01
@bbigboy01 11 ай бұрын
What options are available, due to data security issues, to not use One Drive? Can I use just a local or private server file location for my Word macro/template?
@BarbHendersonconsulting
@BarbHendersonconsulting 11 ай бұрын
I think you would have to download both to your personnel computer. Macros do not run on networks.
@JordanNash-dm1cd
@JordanNash-dm1cd Жыл бұрын
Hi, I run the code as exact as you have it but get an error message from the off even trying to open the word document from vba code. Do you have any ideas what code be causing the issue?
@BarbHendersonconsulting
@BarbHendersonconsulting Жыл бұрын
The only thing I can think of is your references. On the vba window if you go to tools - references. These are the references that I have checked. *Visual Basic for Applications *Microsoft Excel 16.0 Object Library *OLE Automation *Microsoft Office 16.0 Object Library
@Pandora44bc
@Pandora44bc Жыл бұрын
thanks Barb!! saved me from writing 27 letters!
@BarbHendersonconsulting
@BarbHendersonconsulting Жыл бұрын
Happy to help!
@bdgalli
@bdgalli 8 ай бұрын
😍 You're a f*** genius!!! Thanks!
@BarbHendersonconsulting
@BarbHendersonconsulting 8 ай бұрын
Glad it helped!
@fatabbott61
@fatabbott61 11 ай бұрын
Hi Barb - great tutorial. My Q is I'd like to use the data input on excel in vertical format so headers would be in column A and the input would be in Column B - how would I adjust the code?
@BarbHendersonconsulting
@BarbHendersonconsulting 11 ай бұрын
That is a big change, I will have to think about that one!
@ErwinLius
@ErwinLius Жыл бұрын
Hey Barb, thanks for the video, i wonder if we can add pages instead and not save as a new word document over and over?
@BarbHendersonconsulting
@BarbHendersonconsulting Жыл бұрын
I have never tried to do that
@TheAthornation
@TheAthornation Жыл бұрын
With a few small edits to Barb's code (thanks to ChatGPT) I got it working after copying and pasting my template onto as many pages as I needed. You could probably automate the copying of the template into as many pages as you need, but I didn't bother for my short dataset. Sub ReplaceText() Dim wApp As Word.Application Dim wdoc As Word.Document Dim custN, path As String Dim r As Long Dim pageNum As Integer r = 2 pageNum = 1 Set wApp = CreateObject("Word.Application") wApp.Visible = True Set wdoc = wApp.Documents.Open(Filename:="file path of word template", ReadOnly:=True) Do While Sheet1.Cells(r, 1) "" With wdoc .Application.Selection.Find.Text = "" .Application.Selection.Find.Execute .Application.Selection = Sheet1.Cells(r, 1).Value .Application.Selection.EndOf .Application.Selection.Find.Text = "" .Application.Selection.Find.Execute .Application.Selection = Sheet1.Cells(r, 2).Value .Application.Selection.EndOf .Application.Selection.Find.Text = "" .Application.Selection.Find.Execute .Application.Selection = Sheet1.Cells(r, 3).Value .Application.Selection.EndOf .Application.Selection.Find.Text = "" .Application.Selection.Find.Execute .Application.Selection = Sheet1.Cells(r, 4).Value .Application.Selection.EndOf ' Insert a new page .Application.Selection.InsertNewPage ' Increment the page number pageNum = pageNum + 1 End With r = r + 1 Loop ' Save the final modified document custN = "Progress_Report" path = "file path to save document" wdoc.SaveAs2 Filename:=path & custN & ".docx", _ FileFormat:=wdFormatXMLDocument, AddToRecentFiles:=False ' Close the Word document and quit the application wdoc.Close wApp.Quit ' Release the object references Set wdoc = Nothing Set wApp = Nothing End Sub
@owenmccoy3460
@owenmccoy3460 Жыл бұрын
Hey great video. I used your code and it works great but now I want to modify it so that it only applies to visible rows when I have a filter applied. Any suggestions?
@BarbHendersonconsulting
@BarbHendersonconsulting Жыл бұрын
Have you tried with a filtered list. I know when you send a table to outlook it only send the filtered values.
@KristyCrabtreeseattle
@KristyCrabtreeseattle Ай бұрын
I loved this tutorial! Question - if I wanted to create something that many people could use. Is there a way to get around them having the same the word template on their computers? Or having to adjust the macro to match the word template location?
@BarbHendersonconsulting
@BarbHendersonconsulting Ай бұрын
it probably would be best if you had a copy in numerous locations.
@therealbenriley
@therealbenriley Жыл бұрын
Thanks for this it was really useful. I used it to auto generate reports but as each line feeds down looking for the next field name how would you get it to check the header for one?
@BarbHendersonconsulting
@BarbHendersonconsulting Жыл бұрын
If you have all your fields in one row, it should not got to the next row looking for a field.
@therealbenriley
@therealbenriley Жыл бұрын
@@BarbHendersonconsulting Hi, don’t think I was very clear. In the word template I have a for document number but it’s in the header and appears to be missed. I have read a few threads and they appear to use headerfooterindex to search and add things to the headers?
@BarbHendersonconsulting
@BarbHendersonconsulting Жыл бұрын
@@therealbenriley I have never tried to put the field in a header! Good Luck
@alexen88
@alexen88 Жыл бұрын
Hi Barb, I am still getting "run-time error:'424': Object required" when i add the command do while sheet1.cells(r,1) "". Any help/Tips/clearification?
@BarbHendersonconsulting
@BarbHendersonconsulting Жыл бұрын
you might not have all the references that you need. On the visual basic window -tools -references; I have Visual basic for Application, Microsoft Excel 16.0 Object Library, OLE Automation and Microsoft Office 16.0 Object library checked
@brentondowd3224
@brentondowd3224 3 ай бұрын
Is there a way to have a "Save As" window pop up when it is run, so the user can designate where the word doc is saved? I plan to use this macro for multiple people to use across multiple projects, so saving the document to the same file location would not make sense in my case.
@BarbHendersonconsulting
@BarbHendersonconsulting 3 ай бұрын
I suppose that you could put in a pop-up window asking where you could save it.
@centz_9
@centz_9 Жыл бұрын
Great Video! Can I make this into one document only? I want to create each page on Word docx for each row in Excel.
@BarbHendersonconsulting
@BarbHendersonconsulting Жыл бұрын
I believe so
@nkakonne
@nkakonne Жыл бұрын
Hi Barb, great video! Thank you so much - where would I find the code?
@BarbHendersonconsulting
@BarbHendersonconsulting Жыл бұрын
Scroll down to the bottom of the description
@user-qb2ns4kj1d
@user-qb2ns4kj1d Жыл бұрын
Hey Barb! Excellent video. Really helpful. But I have a single field repeating atleast 10 times in the template. How to replace all of them in one shot?
@BarbHendersonconsulting
@BarbHendersonconsulting Жыл бұрын
you can install this code ActiveDocument.Bookmarks("\StartOfDoc").Select to move to the top of the document and then loop until all the fields are filled.
@jayatikanakia7950
@jayatikanakia7950 Жыл бұрын
This is a great breakdown and really helpful, can you help me understand how can I do this using google sheets excel? Can I use the same script for Google Excel?
@BarbHendersonconsulting
@BarbHendersonconsulting Жыл бұрын
Unfortunately the code for Excel is written in VBA and the code for Google sheets is Java Script, so it will not work.
@Amrorpooo
@Amrorpooo Ай бұрын
Great video barb, very helpful as a beginner. I do have a question though, how do i go about saving the file without keeping the file open? I just want to have the script do all the text replacement without needing to open them all, because i have like 40 rows, so that is 40 files remained open on my computer that i have to close manually. Or if it does "need" to open them all, at least close them once done, any idea?
@BarbHendersonconsulting
@BarbHendersonconsulting Ай бұрын
I think it would be best to keep it open
@NotSoLittleBro
@NotSoLittleBro 8 ай бұрын
Great video! I have been looking for a video like this for days. Does this work with multiple worksheets within a single workbook?
@BarbHendersonconsulting
@BarbHendersonconsulting 8 ай бұрын
you would have to include the worksheet name as well as the cell reference
@NotSoLittleBro
@NotSoLittleBro 8 ай бұрын
could I instead name each cell value I need and call on those instead? for instance in excel I change the name of cell r-1 to "Name". Then in the code could I instead replace r-1 with "Name"@@BarbHendersonconsulting
@user-ws5ld3ke6r
@user-ws5ld3ke6r 11 ай бұрын
Dear Barb, Thank you very much for your tutorial! It is exactly what I was searching for. But If I have 500 rows in my excel file and today I need to populate templates, for example, from 23rd to 54th row, tomorrow I will have to populate another row range. My question is - what should be inserted into the code to proceed only part of the rows?
@BarbHendersonconsulting
@BarbHendersonconsulting 11 ай бұрын
the easiest way you could do that is to copy the desired range to another sheet and run it off that sheet.
@user-ws5ld3ke6r
@user-ws5ld3ke6r 11 ай бұрын
Dear Barb, thank you for the idea
@nithish9041
@nithish9041 Жыл бұрын
for me , the first time values correctly updated but if the same field repeats it does't update the value how can i resolve this issue
@BarbHendersonconsulting
@BarbHendersonconsulting Жыл бұрын
F8 through the code and make sure that the "r" value is actually increasing.
@TateThacker-hf4mz
@TateThacker-hf4mz 4 ай бұрын
Hi there! For some reason, the Word documents the macro creates will only save to a mysterious 'template' folder I can't seem to find on my computer, even though I put in the path to save to a different folder. Any suggestions?
@BarbHendersonconsulting
@BarbHendersonconsulting 4 ай бұрын
It really tried to put it in the templates folder, you might have to change it a couple of times
@carynwilson6732
@carynwilson6732 5 ай бұрын
I was getting the "5152" error because I was trying to create filenames from the value of a cell that contained characters that aren't allowed. Like colons. I replaced these with hyphens and it seemed to work.
@BarbHendersonconsulting
@BarbHendersonconsulting 5 ай бұрын
good to hear!
@ElectricSheep2199
@ElectricSheep2199 Жыл бұрын
Hey Barb! Great Video and very educational. I am having a 5152 Error popping and when I debug it - it points out .SaveAs2 Filename:=path & custN, _ FileFormat:=wdFormatXMLDocument, AddtoRecentFiles:=False The bug says that it's an invalid location but not sure what's wrong with the code as it's the same as yours. Please help and thanks!
@BarbHendersonconsulting
@BarbHendersonconsulting Жыл бұрын
The code would work if you would like to save it to my computer! To determine the path go to the file folder where the file is and go to the menu bar and select copy path. Then you can replace my path with your path.
@ElectricSheep2199
@ElectricSheep2199 Жыл бұрын
@@BarbHendersonconsulting I did put in my own pathway - This is what I have: custN = Sheet1.Cells(r, 1).Value path = "C:\Users\jared.bagnall\Desktop\ALPHA\" .SaveAs2 Filename:=path & custN, _ FileFormat:=wdFormatXMLDocument, AddtoRecentFiles:=False
@ElectricSheep2199
@ElectricSheep2199 Жыл бұрын
​@@BarbHendersonconsulting Is it this that needs to change: .SaveAs2 Filename:=path & custN ?
@juanvalentemeridarodriguez7147
@juanvalentemeridarodriguez7147 10 ай бұрын
Having difficulty doing it on a office 365 for mac.
@BarbHendersonconsulting
@BarbHendersonconsulting 10 ай бұрын
I have never tried it on either 365 or on a Mac, sorry!
@user-ds5pc6he4c
@user-ds5pc6he4c Жыл бұрын
Hi! This is only pulling my first row of data (row 2) and not the entire sheet. Do you have advice on how to correct this?
@BarbHendersonconsulting
@BarbHendersonconsulting Жыл бұрын
Ensure that you have theses lines at the bottom r = r + 1 Loop if you have those f8 through your code and make sure that the r is increasing in the code.
@user-ds5pc6he4c
@user-ds5pc6he4c Жыл бұрын
@@BarbHendersonconsulting Thank you for the reply! I do have these lines at the bottom and my r is increasing in the code. It properly pulls the data from the first row and properly transfers it to the Word template, but then stops and throws the following error, Run-time error '9105': Application-defined or object-defined error.
@BarbHendersonconsulting
@BarbHendersonconsulting Жыл бұрын
What you could do is name your fields in Excel. For example Name=sheet1.cells(r,3).value and then just before the r=r+1 you could refresh the values Name="".
@daltonosmanski6444
@daltonosmanski6444 3 ай бұрын
Hey Barb, how do you get number formatting to carry over? Excel Shows 1,000,000 however in Word it displays as 1000000. Thank you in advance!
@BarbHendersonconsulting
@BarbHendersonconsulting 3 ай бұрын
That is a good question, let me work at it and get back to you
@mcknites1981
@mcknites1981 9 ай бұрын
Hi Barb, your video is a lifesaver, it is brilliant! However, i am having an error with this part ".SaveAs2 Filename:=path & custN, _ FileFormat:=wdFormatXMLDocument, AddtoRecentFiles:=False", i am using Microsoft Office Professional LTC 2021...I cant seem to save, name the file due to fileformat...
@BarbHendersonconsulting
@BarbHendersonconsulting 9 ай бұрын
I don't know what the solution would be, I am not familiar with Microsoft Office Professional LTC 2021
@user-hk1ib7pp1e
@user-hk1ib7pp1e 5 ай бұрын
Thank you, can we make all pages in one word file?
@BarbHendersonconsulting
@BarbHendersonconsulting 5 ай бұрын
Watch this video for longer documents kzbin.info/www/bejne/pWG9qpiDmdN6b80
@user-hk1ib7pp1e
@user-hk1ib7pp1e 5 ай бұрын
@@BarbHendersonconsulting thank you but this is not what I want to do. I have a word template with one page and data in Excel. I want to do something like a mail merge and extract all the data to that word template
@carloscalleperez
@carloscalleperez Жыл бұрын
if i want to copy a excel chart in a especific position, how i can do that? because a chart its not a text and i dont know how to do it
@BarbHendersonconsulting
@BarbHendersonconsulting Жыл бұрын
I have never explored that
@carloscalleperez
@carloscalleperez Жыл бұрын
@@BarbHendersonconsulting today I finish the macro, its easy i use a word document with some especific words and the macro look for them and paste the text or charts from excel
@ElectricSheep2199
@ElectricSheep2199 Жыл бұрын
Is it possible to save them as .PDF? If, so what do you reccomend as far as code?
@BarbHendersonconsulting
@BarbHendersonconsulting Жыл бұрын
My expertise is Excel not Word, this is my best guess ActiveDocument.ExportAsFixedFormat OutputFileName:= _ path & custn.pdf ExportFormat:=wdExportFormatPDF
@ElectricSheep2199
@ElectricSheep2199 Жыл бұрын
@@BarbHendersonconsulting You may not have the expertise but you rock nevertheless. That code worked :)
@BarbHendersonconsulting
@BarbHendersonconsulting Жыл бұрын
@@ElectricSheep2199 I am happy it worked for you
@nevizerkle5774
@nevizerkle5774 6 күн бұрын
Hi Barb! When i click run, there does not appear to be any files created. I checked the file path and it's correct. I cannot figure out why it's not generating an error or docs
@BarbHendersonconsulting
@BarbHendersonconsulting 5 күн бұрын
My advice is to "F8" through the code to see where it is getting hung up
@nevizerkle5774
@nevizerkle5774 4 күн бұрын
​@BarbHendersonconsulting thanks Barb! I adjusted the code so it reads (r, "A") and is now pulling all the correct data and generating the docs, however now I can't figure out why it is populating the top of my doc with the info instead of the square bracketed text as indicated in the code... 🤦‍♂️
@user-uv4dw8qb7e
@user-uv4dw8qb7e Жыл бұрын
I am getting Compile Error: User-defined type not defined on second line of code wApp As Word.Application
@BarbHendersonconsulting
@BarbHendersonconsulting Жыл бұрын
On the visual basic window -tools -references; I have Visual basic for Application, Microsoft Excel 16.0 Object Library, OLE Automation and Microsoft Office 16.0 Object library checked
@kevinlong5864
@kevinlong5864 Жыл бұрын
@@BarbHendersonconsulting I'm getting the same error and I have all the correct references checked. Any other ideas for fixing that error?
@shipcore6757
@shipcore6757 Жыл бұрын
@@kevinlong5864 You need You need Microsoft Word 16.0 Object Library too.
@weixin9270
@weixin9270 8 ай бұрын
@@BarbHendersonconsulting I have all 4 checked but still have the same messge. How come?
@TateThacker-hf4mz
@TateThacker-hf4mz 4 ай бұрын
I got this to work, then adjusted it to do a different sheet. On that sheet, it will only do a few rows (it changes how many each time) then it fails. It says the issue is on .Application.Selection.Find.Text = "" and gives me "Run-time error '462': The remote server machine does not exist or is unavailable." What would you suggest I try?
@BarbHendersonconsulting
@BarbHendersonconsulting 4 ай бұрын
take a look at this one, it is for a longer list of data to word kzbin.info/www/bejne/pWG9qpiDmdN6b80
@TateThacker-hf4mz
@TateThacker-hf4mz 4 ай бұрын
Thank you!! Will do@@BarbHendersonconsulting
@sanjayt222
@sanjayt222 Жыл бұрын
How do I retain formatting of the template?
@BarbHendersonconsulting
@BarbHendersonconsulting Жыл бұрын
the line Set wdoc = wApp.Documents.Open(Filename:="C:\Users\screa\OneDrive econstructionBH\Documents\Excel\welcome.dotx", ReadOnly:=True) The read only prevents the word template from being changed
@SouZiTros
@SouZiTros 5 ай бұрын
Impeccable work. Really helped. Is there a way for the code to also terminate every winword.exe that stays open in the backround?
@BarbHendersonconsulting
@BarbHendersonconsulting 5 ай бұрын
I would be worried about closing it because it might close the process
@jansiegel5575
@jansiegel5575 Жыл бұрын
Thank you Barb, great video! 1) I am experiencing an issue that, it write the data from sheet directly in one line like "Donald Duck11112Vancuver..." Do you have idea why? 2) would it be possible to first find every occurrence of in dotx, replace, and just after that move to another cell (f.e. )? How would you write it? Thank you
@BarbHendersonconsulting
@BarbHendersonconsulting Жыл бұрын
1) I think that it has to do with the formatting on your word document. it replaces the field exactly were it is found. 2)The way I do it does not allow the software to overwite by accident.
@SrirakshaArjun
@SrirakshaArjun 6 ай бұрын
even i am facing the same issue. Instead of finding the and in the word document, it just displays continuously in the beginning "Donald Duck11112Vancuver" in one line. Let me know if you have any solution.
@indreleonaviciene
@indreleonaviciene 8 ай бұрын
Hi Barb, it is extremely helpful. Thank you so much for this. If Word document needs to be named "Mickey Mouse some place" (name+address), how should this be changed correctly? custN = Sheet1.Cells(r, 1).Value Appreciate your help.
@BarbHendersonconsulting
@BarbHendersonconsulting 8 ай бұрын
That should do it!
@indreleonaviciene
@indreleonaviciene 8 ай бұрын
@BarbHendersonconsulting "custN = Sheet1.Cells(r, 1).Value" creates document name of only one value (column 1). If document name must consist of column 1 and column 2 of each row, how this should be done?
@SparxNet
@SparxNet 3 ай бұрын
Wouldn't it be easier to just use the Mail Merge functionality to link particular cells in the Excel sheet to specified fields in the Word document? No need for any VBA code or macros. You can then print out all or specific records either to new individual DOC files or directly to a printer.
@BarbHendersonconsulting
@BarbHendersonconsulting 3 ай бұрын
another option
@finhas8865
@finhas8865 3 ай бұрын
I've tried mail merge method. It's good for something you want to print immediately, as is. But if you want to create a document with some additional pages, or if you need to set some conditions, this method is much better and more flexible.
@amandarose9188
@amandarose9188 Жыл бұрын
so it's a mail merge essentially?
@BarbHendersonconsulting
@BarbHendersonconsulting Жыл бұрын
like mail merge but with VBA
@kamranvohra
@kamranvohra Жыл бұрын
Hi Barb I am getting a compile error User-defined type not defined
@BarbHendersonconsulting
@BarbHendersonconsulting Жыл бұрын
two reasons might be: 1.I am not able to place symbols in the description of the video. the command should read do while sheet1.cells(r,1) "" 2.On the visual basic window -tools -references; I have Visual basic for Application, Microsoft Excel 16.0 Object Library, OLE Automation and Microsoft Office 16.0 Object library checked
@shipcore6757
@shipcore6757 Жыл бұрын
You need Microsoft Word 16.0 Object Library too.
@andjelak2504
@andjelak2504 7 ай бұрын
​@@shipcore6757and then what to use as a object? Because its required now
@BrandonBChambers
@BrandonBChambers 2 ай бұрын
What the heck happened at 3:37?
@BarbHendersonconsulting
@BarbHendersonconsulting 2 ай бұрын
Nothing! before explaining the code I needed to show you what references are required for the code to run!
Power Automate: How to populate a Word Template 📃
24:10
Pragmatic Works
Рет қаралды 183 М.
Каха заблудился в горах
00:57
К-Media
Рет қаралды 8 МЛН
Finger Heart - Fancy Refill (Inside Out Animation)
00:30
FASH
Рет қаралды 26 МЛН
Import Data from Excel into Word Automatically Using VBA
18:23
Dinesh Kumar Takyar
Рет қаралды 282 М.
Merge Excel and Word Documents for Faster Report Writing
8:06
Bilinguistics - Speech Therapy
Рет қаралды 8 М.
How to Create a Template in Word: Creating Templates in Word
12:59
Simon Sez IT
Рет қаралды 529 М.
EASILY Make an Automated Data Entry Form in Excel
14:52
Kenji Explains
Рет қаралды 444 М.
Free Excel VBA Course #35 - Creating Word Reports Using VBA
25:23