Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / March 2006

Tip: Looking for answers? Try searching our database.

Mailmerge from Excel Datasource

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JonathanF - 20 Mar 2006 01:20 GMT
Trying to open an excel datasource, I got message 5640 - Unable to
re-establish DDE to...

Is there something that I need to do to enable DDE?
zkid - 21 Mar 2006 07:21 GMT
This all depends on the version of Word you are using.  97 and 2000 are
different than XP/2002 which is still different than 2003.  Which one are you
using?

> Trying to open an excel datasource, I got message 5640 - Unable to
> re-establish DDE to...
>
> Is there something that I need to do to enable DDE?
JonathanF - 22 Mar 2006 01:47 GMT
Thanks for the reply.  I use Office Pro 2000 on Windows XP.  What I am trying
to do is to create an excel spreadsheet from Access, then open Word and mail
merge using the spreadsheet as data source.

> This all depends on the version of Word you are using.  97 and 2000 are
> different than XP/2002 which is still different than 2003.  Which one are you
[quoted text clipped - 4 lines]
> >
> > Is there something that I need to do to enable DDE?
zkid - 22 Mar 2006 03:41 GMT
I'm a bit pressed for time at the moment, but try the info. at:

http://www.mvps.org/word/FAQs/InterDev/GetDataFromDB.htm

Let me know if it helps.  If not, I will find more info. tomorrow.

zkid

> Thanks for the reply.  I use Office Pro 2000 on Windows XP.  What I am trying
> to do is to create an excel spreadsheet from Access, then open Word and mail
[quoted text clipped - 8 lines]
> > >
> > > Is there something that I need to do to enable DDE?
JonathanF - 22 Mar 2006 04:23 GMT
Thanks for the link.  However, I am not trying to get word to access a
database.  I have an access project frontend to a SQL Server database, and I
have some general filter forms generating different reports or spreadsheet or
other output.  I am trying to extend the options to doing word mailmerge.  
Generating the excel datasource is no problem, and I am able to start up
word, but it fails to link to the excel datasource, erroring on
"re-establishing DDE".

> I'm a bit pressed for time at the moment, but try the info. at:
>
[quoted text clipped - 16 lines]
> > > >
> > > > Is there something that I need to do to enable DDE?
zkid - 22 Mar 2006 05:13 GMT
Okay, let me see if I have this straight.  You are controlling Excel, as well
as Word, from within Access, yes?  Can you supply your code snippet that has
Word accessing the excel datasource?  I will take a look at it in the morning
once I boot up my computer that is running Office 2000 and look at some of my
existing Word/Excel datasource code.

For additional info., you might try this link too:  
http://support.microsoft.com/kb/189259/

> Thanks for the link.  However, I am not trying to get word to access a
> database.  I have an access project frontend to a SQL Server database, and I
[quoted text clipped - 24 lines]
> > > > >
> > > > > Is there something that I need to do to enable DDE?
zkid - 22 Mar 2006 18:25 GMT
Hi Jonathan,

Since I don't have your code, and this is programmed from within Word, not
Access, you might need to tweak it a bit.  However, this code will merge an
excel spreadsheet containing corresponding headings to a Word document's
field codes:

Sub Word2000MailMerge()

Dim strDataSource As String, strDocWithCodes As String, myDoc As Document,
strCurDoc As String

strDocWithCodes = "c:\zivcomdocsss\MergeLtrs\All Fields Template.doc"
strDataSource = "c:\zivcomdocsss\contacts\filtered\ziv.xls"

Documents.Open strDocWithCodes
Set myDoc = ActiveDocument

   myDoc.MailMerge.MainDocumentType = wdFormLetters
   myDoc.MailMerge.OpenDataSource Name:= _
       strDataSource, ConfirmConversions:=False, _
       ReadOnly:=False, LinkToSource:=False, AddToRecentFiles:=False, _
       PasswordDocument:="", PasswordTemplate:="",
WritePasswordDocument:="", _
       WritePasswordTemplate:="", Revert:=False, Format:=wdOpenFormatAuto, _
       Connection:="Entire Spreadsheet", SQLStatement:="", SQLStatement1:=""
   With myDoc.MailMerge
       .Destination = wdSendToNewDocument
       .MailAsAttachment = False
       .MailAddressFieldName = ""
       .MailSubject = ""
       .SuppressBlankLines = True
       With .DataSource
           .FirstRecord = wdDefaultFirstRecord
           .LastRecord = wdDefaultLastRecord
       End With
       .Execute Pause:=True
   End With

strCurDoc = ActiveDocument.ActiveWindow.Caption
myDoc.Close SaveChanges:=wdDoNotSaveChanges
Windows(strCurDoc).Activate

End Sub

If anyone knows how to merge the document with the field codes in it,
without actually opening it up, please add to this thread.

> Okay, let me see if I have this straight.  You are controlling Excel, as well
> as Word, from within Access, yes?  Can you supply your code snippet that has
[quoted text clipped - 33 lines]
> > > > > >
> > > > > > Is there something that I need to do to enable DDE?
JonathanF - 23 Mar 2006 02:03 GMT
Thanks for the link and code.  I tried your code both in Access and in Word
(slight syntax mod in Access), and got the same dde error.

I thought it might have to do with macro security, but got same error with
macro security set to low in both Word and Excel.

I think the problem is probably not in the VBA code, but in something more
fundamental in the O/S, registry, or something.  I am going to find another
computer to test it out.

Thanks for your help.

> Hi Jonathan,
>
[quoted text clipped - 81 lines]
> > > > > > >
> > > > > > > Is there something that I need to do to enable DDE?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.