Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
I am attempting to make a Word Document which has some blanks
auto-populated from an Excel Workbook. It would be best to create a Word Document to a sheet of an excel workbook. Am I on the right track? How do I populate the blanks? |
#2
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Whoa! Looks like this is your first post ever, and you're posting in the
Excel Functions area, when you should really be posting this question in the Excel Programming area. Oh well, I'll tell you how to do what you want to do, but I feel it may take a little effort on your part to grasp everything. How to send data from Excel to Word (using Fields): In Word, click Insert Field DocVariable, then name your DocVariable. Repeat as many times as necessary. In this example, I am using BrokerFirstName and BrokerLastName. Basically, Im doing some analytics in Excel, and preparing the results, in the form of a letter, to a StockBroker, including the brokers first and last name and as many other variables as necessary. In Excel, hit Alt+F11, click Tools References check the reference for Microsoft Word xx.x Object Library. Then copy/paste this code into Excels Visual Basic Editor window: Sub PushToWord() Dim objWord As New Word.Application Dim doc As Word.Document Dim bkmk As Word.Bookmark sWdFileName = Application.GetOpenFilename(, , , , False) Set doc = objWord.Documents.Open(sWdFileName) 'On Error Resume Next objWord.ActiveDocument.variables("BrokerFirstName" ).Value = Range("BrokerFirstName").Value objWord.ActiveDocument.variables("BrokerLastName") .Value = Range("BrokerLastName").Value objWord.ActiveDocument.Fields.Update 'On Error Resume Next objWord.Visible = True End Sub A few more examples for you... Take a look at this: http://word.mvps.org/FAQs/InterDev/C...WordFromXL.htm This too: http://addbalance.com/usersguide/fields.htm And this: http://gregmaxey.mvps.org/Word_Fields.htm Finally, once you get the DocVariable fields set up in Word (hit Alt + F9 to see all fields), run this code from Excel. Sub PushToWord() Dim objWord As New Word.Application Dim doc As Word.Document Dim bkmk As Word.Bookmark sWdFileName = Application.GetOpenFilename(, , , , False) Set doc = objWord.Documents.Open(sWdFileName) With doc ..Variables("VarNumber1").Value = Range("VarNumber1").Value ..Variables("VarNumber2").Value = Range("VarNumber2").Value 'etc ..Range.Fields.Update End With 'ActiveDocument.Fields.Update objWord.Visible = True End Sub Note: This code runs in Excel; pushes Excel variables (assigned as Named Ranges) to Word. HTH, Ryan-- -- Ryan--- If this information was helpful, please indicate this by clicking ''Yes''. "LUCHA" wrote: I am attempting to make a Word Document which has some blanks auto-populated from an Excel Workbook. It would be best to create a Word Document to a sheet of an excel workbook. Am I on the right track? How do I populate the blanks? |
#3
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
If you are using 07 then the process of linking is relatively simple.
Highlight the cells in Excel that you want to connect to Word and press cntrl + C, to activate the copy function. Go to the place in Word where you want this to appear and then click the drop down menu below the Paste icon on the Home ribbon. Choose Paste Special. You will now be presented with a Paste Special dialog box. Choose the Paste Link option on the left hand side and then select the type of link that you want to create. You will need to experiment with the formatting in both the Excel document and the Word document as there are some issues here. If this is helpful, please click Yes. "LUCHA" wrote: I am attempting to make a Word Document which has some blanks auto-populated from an Excel Workbook. It would be best to create a Word Document to a sheet of an excel workbook. Am I on the right track? How do I populate the blanks? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Auto populate name | Excel Discussion (Misc queries) | |||
auto locking of excell workbook (excell 2003) | Excel Discussion (Misc queries) | |||
Auto-populate, Auto-copy or Auto-fill? | Excel Worksheet Functions | |||
Auto populate with value | Excel Discussion (Misc queries) | |||
auto populate | Excel Discussion (Misc queries) |