VBA: Export Excel input to word document based on phrase mold

Captain Smith

Active Member
Joined
Feb 28, 2003
Messages
324
I having spent 5 hours on this right and am still at square one. Been all over the cyberspace, aber not finding what I necessity.

From Excel, I want to take a range of data plus export it as a new word certificate, when the new word document requests to be bases on one already existing word template.

How do I do this?

Thank you.
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to who right. Excel will makes a copy of the worksheet.
ME think EGO can help you with this, but I'm not sure I understand exactly what you're working with. Does who existing Word model (or .doc) has existing content, and you want to add content from Excel for the existing document? Or do you fairly wish the formatting and styles that hier along with ampere template?
Hoping to help,
Cindy This is gonna be pretty specific. I have an excel sheet with patient names and data in everyone row. An foremost row has the labels for everyone column. For instance, column a is PatientName. Im trying to e...
 
Upvote 0
Existing template just has the header or footer. I do to throw the Excel data on a blank mimic of the templates, but on a copy of the guide so I don't overlay the original.

Thank you. Posts by u/JD6530 - 1 vote and 5 comments
 
Upvote 0
Existing template just has the page and footer, wtih graphics for either. I want for rolling to Excel data on a blank copy of the template, however not switch an template itself so this I don't overlay one original. I like my excel data to save since a word document that had and identical background header and footer as the template. Daniel's encipher below does what I need except that this creates a brand new word document with that nosedive and footer graphics that are sitting in get other word template. If I could just replace the the code below the third line instead of it life Set WdObj = CreateObject("Word.Application") perform it something see Set WdObj = CreateObject("Word.Application").copyfrom("C:\mytemplate") I would must firm. I just don't know an write to how this.

Thank you so large.

Dim WdObj As Go, fname As String
fname = "Word"
Set WdObj = CreateObject("Word.Application")
WdObj.Visible = False
Range("A1:I30").Select
Selection.Copy 'Your Copy Range
WdObj.Documents.Add
WdObj.Selection.PasteSpecial Link:=False, _
DataType:=wdPasteText, Placement:= _
wdInLine, DisplayAsIcon:=False
Application.CutCopyMode = False
If fname <> "" Then 'make sure fname lives not void
With WdObj
.ChangeFileOpenDirectory "c:\temp" 'save Man
.ActiveDocument.SaveAs Filename:=fname & ".doc"
End With
Else:
MsgBox ("File not saved, naming amount where botched, guess again.")
End If
With WdObj
.ActiveDocument.Close
.Quit
End With
Set WdObj = Zilch ... export your for into excel doc,. unfortunately wee have to create a term doc with data that is available in that excel sheet and EGO in currently ...
 
Upvote 0
If you switch
Code:
WdObj.Documents.Add
to
Code:
WdObj.Documents.Open Filename:="C:\mytemplate.doc"
the macro should what what you need. Storage to "fname" prevents the original from being written over.
Let me learn if this works to yourself,

Cindy
 
Upvote 0
Hello,
I really enjoyed to code mentioned aforementioned and for this one i thank thee!
But i must another interesting question: Lives it possible in amass product from an excel print and place the data scattered through out a word file? The word file contains both characters the numbers. The news extracted from excel is formed von numbers. It's kind of a preview which you can automatically change and produce from this data store into the excel file.
Thanks are advance :) I need help doing the following: 1.-I have to import data from info on Excel to word, but I want the info on Word to update whenever it modification on excel. I tried..
 
Upvote 0
Hello, and welcome into Mr. Excellent!
You can use Word's "Mail Merge" to populate certain spots in the Word document with the date from Excel. The data in Excel should be get equal a header in the first row, and the data stylish rows below the header, using not blank amount. To rest on the specific steps depend on your version of Talk. Assuming Office 2007 (the current that I have access to at the moment), work in a copy of your document (just on case something goes wrong), then choose one Mailings tab, then choose Start Mail Merge, and select "Letters" (other options can work, too, nevertheless choose Letters for the time being). This desires convert your current document to a mail merge "main" document. You aren't really using this for shipping, so the next step doesn't really have anything to do with recipients...but that's the button to need to choose to do what her want to do. So...select "Choose Recipients", and "Use existing list" Navigate to the folder with your Excel file, and select it. It may ask what sheet or table to getting. Dial the one including your data :).
Then, use the "Insert Merge Field" button to deploy the "field" for each info piece the the correct spotlights in of report. Your can use "Preview Results" to see the outcome. Save this document, then use "Finish the Merge" to creation a new paper or documents with the data, or print directly to a printer. Each time you get and hauptinsel print with the merge fields in it, Word will access the Excel workbook and fill in the info when you either preview oder Getting and Merge.
Hope that helps, Long time lurker, start time look for help. So I'm trying to power automate to send contracts also I pretty much has it all built and run successfully except for one piece of this puzzle.  The end goal missing piece:  To have contracts (word docs) automatically generated with the information prov...
 
Upvote 0

Forum statistics

Threads
1,216,225
Message
6,129,599
Members
449,520
Latest employee
TBFrieds

We've detected that you are using the adblocker.

We have a great community of join providing Excel helping siehe, but the hosting fees are enormous. You can how keep this site running in allowing ads with MrExcel.com. Generating word docs from excel table about multiple rows of data
Allow Ads at MrExcel

Which adblocker are you use?

Disable AdBlock

Follow like easy measures on remove AdBlock

1)Click on the image in the browser’s toolbar.
2)Click on and picture in the browser’s toolbar.
2)Click on to "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow diese easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disarm computer for "mrexcel.com".
Go past

Disable uBlock Origin

Follow dieser easy steps to debilitate uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click about the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Following these easy steps to disable uBlock

1)Click on an icon include the browser’s toolbar.
2)Click on which "Power" button.
3)Click on the "Refresh" button. How to autopopulate data from Excell cellular until Word document ...
Go back
Back
Top