Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
rjr rjr is offline
external usenet poster
 
Posts: 50
Default Open WORD Doc and assign Excel tab as data source for merge.

Hello,
I am using Excel 2003 and Windows XP Pro on my machine. I have a workbook
that has a tab named "Database". This "Database" is used to provide
information for WORD documents (merge letters) for a mail merge. I need Code
to run from the Excel workbook that will open the specific WORD merge letter
and assign the datasource tab without seeing a message box or prompt.
I found this and it opens the actual document but stops there. WHen I run
this I get the message box to select the tab where the data is located.

My data is contained in the Excel workbook that is active, and the data is
contained in a tab "Database"

I don't want to have to select the data base each time and all files will be
fixed and no variation in the name.

Any Help would be greatly appreciated,

BOB REYNOLDS


Sub OpenWordDoc()
Dim wdApp As Word.Application, wdDoc As Word.Document
On Error Resume Next
Set wdApp = GetObject(, "Word.Application")
If Err.Number < 0 Then 'Word isn't already running
Set wdApp = CreateObject("Word.Application")
End If
On Error GoTo 0
Set wdDoc =
wdApp.Documents.Open("C:\LettersFormsCOJMaster\Let ters01232007\L06Closurewithpayment01232007.dot")
'This path is fixed and will not vary.
wdApp.Visible = True
End Sub


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Mail Merge With Word, More than 1 Data Source dawn_dudley[_2_] Excel Discussion (Misc queries) 3 June 7th 08 05:51 PM
word can't open excel data source arhpip Excel Discussion (Misc queries) 0 December 9th 07 11:11 PM
Excel data source will not merge changes to Word Jennifer Mcdermeit Excel Discussion (Misc queries) 2 July 20th 06 07:31 PM
Link excel and word in mail merge without losing your data source? angie Excel Discussion (Misc queries) 5 July 1st 05 06:29 PM
Mail Merge from Excel Data Source to Word Mike Elkevizth Excel Programming 0 October 21st 04 10:09 PM


All times are GMT +1. The time now is 07:31 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"