Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If you can write VBA code, it can be done on either sides: in Word, or in
Excel. From Excel side: 1. Set Reference to Work Object Library in VBA IDE; 2. Start Word and open certain doc file: Dim wd AS Word.Application Dim doc As Word.Document Set wd=New Word.Application wd.Visibale=True Set doc=wd.Documents.Open("C:\MyPath\MyDoc.doc) 'do soemthing with the opened document, such as grab data from current worksheet to update filed/bookmark on document 'Print the doc... doc.Close True wd.Quit From Word side: 1. Set reference to Excel Object Library 2. Start Excel and open certain workbook Dim xls as Excel.Application Dim wb As WorkBook Dim sh As Worksheet Set xls=New Excel.Application xls.Visible=True Set wb=xls.Workbooks.Open("....") Set sh=wb.Sheet(1) 'Assume the first sheet has needed data 'Get data from the cells on the sheet, 'Update existing doc's field/bookmark 'Print the doc, if needed Set sh=Nothing wk.Close Flase xls.Quit With latter, you can even get data from Worksheet by using ADO without open Excel, this makes your code run quicker. "Yendorian" wrote in message ... Working in Office 2003, I have information in an EXCEL file which I can mailmerge manually into a WORD doc. I would like to automate this process from a button in the EXCEL file to ask the user if he wants to view the mailmerged WORD doc. which then goes on to carry out the mailmerge and display the final result in WORD. If I want to give the option to print out the WORD doc, does this have to be part of the EXCEL or the WORD macro? Any help appreciated. Yendorian |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Open Word from Excel | Excel Programming | |||
Excel Hyperlink doesn't open Word doc the same way as Word does | Excel Discussion (Misc queries) | |||
open word doc from within excel with VBA | Excel Programming | |||
Graph Excel Selection, Open Word File, Embed Graph Into Word | Excel Programming | |||
In Excel VBA, open .txt with Word? | Excel Programming |