Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
cw cw is offline
external usenet poster
 
Posts: 6
Default automating the SQL warning and the choice of text format

Hi all (again)

I was just wondering as I am trying to automate a word mail merge as much as
possible (least user clicks)

is it possible to automate the dialog boxes that appear when opening a word
file that use mail merge

in particular the "this file will run an SQL command select * from ... "
click yes and the " what is the encoding of this text file" I want that to
be default utf-8

any thoughts

I have managed to get my filemaker database to export the word file stored
in a container field and export the records to a text file open them both
(then the user needs to interact), then it performs the mail merge closes
the files and deletes all but the final word doc

just need to get rid of those user interactions in the middle

thanks for any input
Craig

I am using word 2007 but it needs to work on all of the latest version if
poss




  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default automating the SQL warning and the choice of text format

You may be able to do some of this, but you really need to make a change to
the Windows registry, and you'll probably have to create one or more extra
files for each file you want to use as a data source. I haven't used this
approach much for real, so would be interested to hear whether it works for
you or not.

For the Windows registry change, see

http://support.microsoft.com/Default.aspx?kbid=825765

That should get rid of the "SQL command" messages. However, before you do
that, can you tell me whether the SQL message is displaying the correct name
of the file you are trying to connect to? Here, but only with Word 2007,
Word seems to invent a file name (e.g. I try to connect to kt.txt, but the
message displays txt1380.txt).

In order to get the correct encoding, I believe that you have to do the
following:
a. use a .odc file to connect to the data
b. use a SCHEMA.INI file to specify the encoding.

For example, suppose you want to connect to c:\myfiles\mydata.txt and the
file is in UTF-8 format. Then you need a .odc file (Office Data Connection
File) as follows (this has a lot of stuff which you do not absolutely need
but which Office inserts when you create it):

-----------------------------------------------------------------

html xmlns="urn:schemas-microsoft-comfficeffice"
xmlns="http://www.w3.org/TR/REC-html40"

head
meta http-equiv=Content-Type content="text/x-ms-odc; charset=utf-8"
meta name=ProgId content=ODC.Table
meta name=SourceType content=OLEDB
meta name=Table content="mydata#txt"
titlemydata#txt/title
xml id=docpropsoocumentProperties
xmlns="urn:schemas-microsoft-comfficeffice"
xmlns="http://www.w3.org/TR/REC-html40"
o:Namemydata#txt/o:Name
/oocumentProperties
/xmlxml id=msodcodc:OfficeDataConnection
xmlnsdc="urn:schemas-microsoft-comfficedc"
xmlns="http://www.w3.org/TR/REC-html40"
odc:Connection odc:Type="OLEDB"
odc:ConnectionStringProvider=Microsoft.ACE.OLEDB .12.0;User
ID=Admin;Data Source=c:\myfiles\;Mode=Share Deny None;Extended
Properties="";Jet OLEDB:System database="";Jet
OLEDB:Registry Path="";Jet OLEDB:Engine Type=96;Jet OLEDBatabase
Locking Mode=0;Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Global Bulk
Transactions=1;Jet OLEDB:New Database Password="";Jet OLEDB:Create
System Database=False;Jet OLEDB:Encrypt Database=False;Jet OLEDBon't Copy
Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;Jet
OLEDB:SFP=False;Jet OLEDB:Support Complex Data=False/odc:ConnectionString
odc:CommandTypeTable/odc:CommandType
odc:CommandTextmydata#txt/odc:CommandText
/odc:Connection
/odc:OfficeDataConnection
/xml
style
!--
.ODCDataSource
{
behavior: url(dataconn.htc);
}
--
/style

/head

body onload='init()' scroll=no leftmargin=0 topmargin=0 rightmargin=0
style='border: 0px'
table style='border: solid 1px threedface; height: 100%; width: 100%'
cellpadding=0 cellspacing=0 width='100%'
tr
td id=tdName style='font-family:arial; font-size:medium; padding: 3px;
background-color: threedface'
 
/td
td id=tdTableDropdown style='padding: 3px; background-color:
threedface; vertical-align: top; padding-bottom: 3px'

 
/td
/tr
tr
td id=tdDesc colspan='2' style='border-bottom: 1px threedshadow solid;
font-family: Arial; font-size: 1pt; padding: 2px; background-color:
threedface'

 
/td
/tr
tr
td colspan='2' style='height: 100%; padding-bottom: 4px; border-top:
1px threedhighlight solid;'
div id='pt' style='height: 100%' class='ODCDataSource'/div
/td
/tr
/table


script language='javascript'

function init() {
var sName, sDescription;
var i, j;

try {
sName = unescape(location.href)

i = sName.lastIndexOf(".")
if (i=0) { sName = sName.substring(1, i); }

i = sName.lastIndexOf("/")
if (i=0) { sName = sName.substring(i+1, sName.length); }

document.title = sName;
document.getElementById("tdName").innerText = sName;

sDescription = document.getElementById("docprops").innerHTML;

i = sDescription.indexOf("escription")
if (i=0) { j = sDescription.indexOf("escription", i + 11); }

if (i=0 && j = 0) {
j = sDescription.lastIndexOf("/", j);

if (j=0) {
sDescription = sDescription.substring(i+11, j);
if (sDescription != "") {
document.getElementById("tdDesc").style.fontSize=" x-small";
document.getElementById("tdDesc").innerHTML = sDescription;
}
}
}
}
catch(e) {

}
}
/script

/body

/html

-----------------------------------------------------------------
You need one of those for each data source. You will need to change the path
name in the connection string to be the name of the folder containing the
text file you want to use, and change the file name in the various places it
occurs (Actually, I suspect it would be enough to change it in the line that
says "meta name=Table content="mydata#txt"". Notice that "#" is used
instead of "." in this type of .odc file - I don't know if that is entirely
necessary. If you copy the DATACONN.HTC file from your My Data Sources
folder to the same folder as the .odc and try to open the .odc in Internet
Explorer, with any luck you wil see the text file content. That's not
essential for your task, but a useful technique when debugging .odc files.

To specify the character encoding of the text file, you need a SCHEMA.INI
file in the same folder as the text file. The SCHEMA.INI file is a text file
that you can edit with Notepad. has one "section" for each file you want to
describe. For a comma-delimited file using UTF-8 encoding, try:

[mydata.txt]
ColNameHeader=True
Format=Delimited(,)
MaxScanRows=25
CharacterSet=65001


ColNameHeader specifies that he first row in your data file contains column
names.

MaxScanRows is probably optional in this case.

Peter Jamieson

"cw" wrote in message
...
Hi all (again)

I was just wondering as I am trying to automate a word mail merge as much
as possible (least user clicks)

is it possible to automate the dialog boxes that appear when opening a
word file that use mail merge

in particular the "this file will run an SQL command select * from ... "
click yes and the " what is the encoding of this text file" I want that
to be default utf-8

any thoughts

I have managed to get my filemaker database to export the word file stored
in a container field and export the records to a text file open them both
(then the user needs to interact), then it performs the mail merge closes
the files and deletes all but the final word doc

just need to get rid of those user interactions in the middle

thanks for any input
Craig

I am using word 2007 but it needs to work on all of the latest version if
poss






  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
cw cw is offline
external usenet poster
 
Posts: 6
Default automating the SQL warning and the choice of text format

Wow

That all look pretty intense!

I was hoping for something that would work at runtime that would
automatically select 'yes' and 'utf-8' rather than changing the registry,
but as the Microsoft knowledge base states its there as security measure so
I doubt that will be possible for the SQL

I will certainly gives these a go and let you know how I get on

Thanks very much
Craig



"Peter Jamieson" wrote in message
...
You may be able to do some of this, but you really need to make a change
to the Windows registry, and you'll probably have to create one or more
extra files for each file you want to use as a data source. I haven't used
this approach much for real, so would be interested to hear whether it
works for you or not.

For the Windows registry change, see

http://support.microsoft.com/Default.aspx?kbid=825765

That should get rid of the "SQL command" messages. However, before you do
that, can you tell me whether the SQL message is displaying the correct
name of the file you are trying to connect to? Here, but only with Word
2007, Word seems to invent a file name (e.g. I try to connect to kt.txt,
but the message displays txt1380.txt).

In order to get the correct encoding, I believe that you have to do the
following:
a. use a .odc file to connect to the data
b. use a SCHEMA.INI file to specify the encoding.

For example, suppose you want to connect to c:\myfiles\mydata.txt and the
file is in UTF-8 format. Then you need a .odc file (Office Data Connection
File) as follows (this has a lot of stuff which you do not absolutely need
but which Office inserts when you create it):

-----------------------------------------------------------------

html xmlns="urn:schemas-microsoft-comfficeffice"
xmlns="http://www.w3.org/TR/REC-html40"

head
meta http-equiv=Content-Type content="text/x-ms-odc; charset=utf-8"
meta name=ProgId content=ODC.Table
meta name=SourceType content=OLEDB
meta name=Table content="mydata#txt"
titlemydata#txt/title
xml id=docpropsoocumentProperties
xmlns="urn:schemas-microsoft-comfficeffice"
xmlns="http://www.w3.org/TR/REC-html40"
o:Namemydata#txt/o:Name
/oocumentProperties
/xmlxml id=msodcodc:OfficeDataConnection
xmlnsdc="urn:schemas-microsoft-comfficedc"
xmlns="http://www.w3.org/TR/REC-html40"
odc:Connection odc:Type="OLEDB"
odc:ConnectionStringProvider=Microsoft.ACE.OLEDB .12.0;User
ID=Admin;Data Source=c:\myfiles\;Mode=Share Deny None;Extended
Properties="";Jet OLEDB:System database="";Jet
OLEDB:Registry Path="";Jet OLEDB:Engine Type=96;Jet
OLEDBatabase Locking Mode=0;Jet OLEDB:Global Partial Bulk Ops=2;Jet
OLEDB:Global Bulk Transactions=1;Jet OLEDB:New Database
Password="";Jet OLEDB:Create System Database=False;Jet
OLEDB:Encrypt Database=False;Jet OLEDBon't Copy Locale on
Compact=False;Jet OLEDB:Compact Without Replica Repair=False;Jet
OLEDB:SFP=False;Jet OLEDB:Support Complex
Data=False/odc:ConnectionString
odc:CommandTypeTable/odc:CommandType
odc:CommandTextmydata#txt/odc:CommandText
/odc:Connection
/odc:OfficeDataConnection
/xml
style
!--
.ODCDataSource
{
behavior: url(dataconn.htc);
}
--
/style

/head

body onload='init()' scroll=no leftmargin=0 topmargin=0 rightmargin=0
style='border: 0px'
table style='border: solid 1px threedface; height: 100%; width: 100%'
cellpadding=0 cellspacing=0 width='100%'
tr
td id=tdName style='font-family:arial; font-size:medium; padding: 3px;
background-color: threedface'
 
/td
td id=tdTableDropdown style='padding: 3px; background-color:
threedface; vertical-align: top; padding-bottom: 3px'

 
/td
/tr
tr
td id=tdDesc colspan='2' style='border-bottom: 1px threedshadow solid;
font-family: Arial; font-size: 1pt; padding: 2px; background-color:
threedface'

 
/td
/tr
tr
td colspan='2' style='height: 100%; padding-bottom: 4px; border-top:
1px threedhighlight solid;'
div id='pt' style='height: 100%' class='ODCDataSource'/div
/td
/tr
/table


script language='javascript'

function init() {
var sName, sDescription;
var i, j;

try {
sName = unescape(location.href)

i = sName.lastIndexOf(".")
if (i=0) { sName = sName.substring(1, i); }

i = sName.lastIndexOf("/")
if (i=0) { sName = sName.substring(i+1, sName.length); }

document.title = sName;
document.getElementById("tdName").innerText = sName;

sDescription = document.getElementById("docprops").innerHTML;

i = sDescription.indexOf("escription")
if (i=0) { j = sDescription.indexOf("escription", i + 11); }

if (i=0 && j = 0) {
j = sDescription.lastIndexOf("/", j);

if (j=0) {
sDescription = sDescription.substring(i+11, j);
if (sDescription != "") {
document.getElementById("tdDesc").style.fontSize=" x-small";
document.getElementById("tdDesc").innerHTML = sDescription;
}
}
}
}
catch(e) {

}
}
/script

/body

/html

-----------------------------------------------------------------
You need one of those for each data source. You will need to change the
path name in the connection string to be the name of the folder containing
the text file you want to use, and change the file name in the various
places it occurs (Actually, I suspect it would be enough to change it in
the line that says "meta name=Table content="mydata#txt"". Notice that
"#" is used instead of "." in this type of .odc file - I don't know if
that is entirely necessary. If you copy the DATACONN.HTC file from your My
Data Sources folder to the same folder as the .odc and try to open the
.odc in Internet Explorer, with any luck you wil see the text file
content. That's not essential for your task, but a useful technique when
debugging .odc files.

To specify the character encoding of the text file, you need a SCHEMA.INI
file in the same folder as the text file. The SCHEMA.INI file is a text
file that you can edit with Notepad. has one "section" for each file you
want to describe. For a comma-delimited file using UTF-8 encoding, try:

[mydata.txt]
ColNameHeader=True
Format=Delimited(,)
MaxScanRows=25
CharacterSet=65001


ColNameHeader specifies that he first row in your data file contains
column names.

MaxScanRows is probably optional in this case.

Peter Jamieson

"cw" wrote in message
...
Hi all (again)

I was just wondering as I am trying to automate a word mail merge as much
as possible (least user clicks)

is it possible to automate the dialog boxes that appear when opening a
word file that use mail merge

in particular the "this file will run an SQL command select * from ... "
click yes and the " what is the encoding of this text file" I want that
to be default utf-8

any thoughts

I have managed to get my filemaker database to export the word file
stored in a container field and export the records to a text file open
them both (then the user needs to interact), then it performs the mail
merge closes the files and deletes all but the final word doc

just need to get rid of those user interactions in the middle

thanks for any input
Craig

I am using word 2007 but it needs to work on all of the latest version if
poss








Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
disable format warning message on saving stef New Users 11 December 17th 06 06:39 AM
Automating text input Ricki Miles Microsoft Word Help 1 March 16th 06 02:01 AM
When I copy how do I make my destination format my default choice rocjames Microsoft Word Help 1 December 1st 05 06:32 AM
Table Format for Caution or Warning Notes RKL Tables 2 November 17th 05 12:24 AM
How do I format a multiple choice test in MS Word? [email protected] Microsoft Word Help 2 April 22nd 05 05:00 PM


All times are GMT +1. The time now is 02:32 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"