ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macros across office programs... (https://www.excelbanter.com/excel-programming/353395-macros-across-office-programs.html)

Kat

Macros across office programs...
 
Is there any way to write a macro that will open an existing word document
and insert certain fields from my spreadsheet automatically when specific
text is typed into a specific field?
In depth/personal replies are greatly appreciated, and can be sent to kdt AT
chainstarusa DOT com

thanks
kat

NickHK

Macros across office programs...
 
kat,
You need to look in Automation, the means by which you can control one
application from another. e.g.
Dim MyWord as Word.Application
Set MyWord=New Word.Application
MyWord.Documents.Add
.... etc (but I don't know the Word Object Model)
The easist way to start is record a macro in Word, so you can see what you
need achieve, then transfer this code to Excel, changing the references to
allow for the fact that the code is now in Excel (i.e. so all calls go
through the MyWord, or related, object).
Make sure you .Quit Word and set all object to Nothing, otherwise you will
trouble getting rid of the instances that you create.

Google for "Office Automation", or use that old fashion reference, Your
Local Library.

Nick

"Kat" wrote in message
...
Is there any way to write a macro that will open an existing word document
and insert certain fields from my spreadsheet automatically when specific
text is typed into a specific field?
In depth/personal replies are greatly appreciated, and can be sent to kdt

AT
chainstarusa DOT com

thanks
kat





All times are GMT +1. The time now is 11:26 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com