![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Feb 2002
Location: Essex, England
Posts: 458
|
I am trying to write a macro that will extract a bunch of information from a spreadsheet and use it to produce letters in Word97 using mailmerge. The data extraction bit works fine and generates a data file for me, and I can switch to Word using "Application.ActivateMicrosoftApp xlMicrosoftWord", but how do I get my Word doc to open automatically?
|
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Allentown, PA
Posts: 2,510
|
Gary, I believe this is already automated for you using Mail Merge. See the steps at my site by clicking on the Word Stuff link. Let me know if you have any problems with that. Basically, you don't need to create a separate file to do a mail merge, which has its own query options.
__________________
~Anne Troy |
|
|
|
|
|
#3 |
|
Guest
Posts: n/a
|
I had the same problem as you. This code should work.
Sub MtoOpenWord() Dim wdApp As Object Set wdApp = CreateObject("Word.Application") wdApp.Visible = True wdApp.documents.Open "C:FILENAME.doc" End Sub Where FILENAME type the name of your file. |
|
|
|
#4 |
|
Board Regular
Join Date: Feb 2002
Location: Essex, England
Posts: 458
|
That seems to do the trick!
Many thanks Gary |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|