pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: david.paulo <david.paulo@legalfirst.com.au>
To: pgsql-odbc@postgresql.org
Subject: Re: ODBC problem with Microsoft Word and Excel
Date: Tue, 6 Oct 2015 22:47:07 -0700 (MST)
Message-ID: <1444196827343-5869049.post@n5.nabble.com> (raw)
In-Reply-To: <00bc01c75d00$fcbd5c40$0d01a8c0@karlsdesktop>
References: <00bc01c75d00$fcbd5c40$0d01a8c0@karlsdesktop>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-odbc>

Here is what I needed to do
1) Use ANSI odbc driver - this is key  - Unicode does not work - I am using
version 9.03.04.00.  In this example the name of the odbc DSN is LFData.  It
has a username and password embedded in it.
2) It may not be needed for word merge (I am also doing separate queries)
but I registered Microsoft ActiveX Data Objects 6.1 Library from the VBA
Tools menu
3) Within the macro that performs the merge I have the following (xcfPax is
a view that provides the fields for the merge):
    SQLRequest = "select * from xcfPax where matterno = '" & matterRef & "'"
    
    Doc.MailMerge.MainDocumentType = wdFormLetters
    Doc.MailMerge.Destination = wdSendToNewDocument
    
    Doc.MailMerge.OpenDataSource _
      Name:="", _
      SQLStatement:=SQLRequest, _
      AddToRecentFiles:=False, _
      Connection:="DSN=LFData", _
      SubType:=wdMergeSubTypeWord2000

    ' Execute the mail merge.
    Doc.MailMerge.Execute
    Doc.MailMerge.DataSource.Close




--
View this message in context: http://postgresql.nabble.com/ODBC-problem-with-Microsoft-Word-and-Excel-tp2189996p5869049.html
Sent from the PostgreSQL - odbc mailing list archive at Nabble.com.


-- 
Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc



view thread (10+ messages)

Message-ID: <1444196827343-5869049.post@n5.nabble.com>
Permalink:  ../1444196827343-5869049.post@n5.nabble.com/
Also on:    postgresql.org/message-id/1444196827343-5869049.post@n5.nabble.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-odbc@postgresql.org
  Cc: david.paulo@legalfirst.com.au
  Subject: Re: ODBC problem with Microsoft Word and Excel
  In-Reply-To: <1444196827343-5869049.post@n5.nabble.com>
  References: <00bc01c75d00$fcbd5c40$0d01a8c0@karlsdesktop> <1444196827343-5869049.post@n5.nabble.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox