A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » Mailmerge
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

AVOIDING "Select Data Source" dialog box?!?



 
 
Thread Tools Display Modes
  #1  
Old May 24th, 2004, 09:20 AM
Alessio
external usenet poster
 
Posts: n/a
Default AVOIDING "Select Data Source" dialog box?!?

Hello,
my problem is very simple, yet it seems not to have a solution.
It happens with a certain Word2003 mailmerge document: I open it using
Word2003 (through OLE), and a "Select Data Source" dialog box appears,
asking me to specify the data source path. If I manually cancel that
dialog box, then everything seems to work as usual (i.e., as Word2000
usually behaves), and the automation code works.
But, HOW CAN I AVOID THAT DIALOG BOX ?!?!? IT MAKES THE AUTOMATION
CODE HANG!!!
Please note: the dialog box I'm talking about is not the one carrying
the two buttons "Finds data source..." and "Options..."; it is an
open-file-style dialog.
Thank you very much, and more
have a nice day
Alessio
  #2  
Old May 24th, 2004, 03:38 PM
Cindy M -WordMVP-
external usenet poster
 
Posts: n/a
Default AVOIDING "Select Data Source" dialog box?!?

Hi Alessio,

Please post the OpenDataSource method's code you're trying to use.

Note that there was a very important change in this method's syntax
starting with Word 2002. So you probably will need to either have two
procedures (one for 2000/97, another 2002 and later) or you will have to
use late binding for the Word object model.

It happens with a certain Word2003 mailmerge document: I open it using
Word2003 (through OLE), and a "Select Data Source" dialog box appears,
asking me to specify the data source path. If I manually cancel that
dialog box, then everything seems to work as usual (i.e., as Word2000
usually behaves), and the automation code works.
But, HOW CAN I AVOID THAT DIALOG BOX ?!?!? IT MAKES THE AUTOMATION
CODE HANG!!!


Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question
or reply in the newsgroup and not by e-mail :-)

  #3  
Old May 25th, 2004, 08:39 AM
Alessio
external usenet poster
 
Posts: n/a
Default AVOIDING "Select Data Source" dialog box?!?

Hi Cindy,
the point is that I'm not trying to open the data source. The method
I'm using, causing that dialog box to appear, is the Open method of a
Documents object (it's a VC++.NET application). Here's the code of the
Open method:
....
oDoc = m_oDocs.Open( COleVariant( szPath ), // name
vtFalse, // ConfirmConversions
vtFalse, // ReadOnly
vtFalse, // AddToRecentFiles
vtOpt, // PasswordDocument
vtOpt, // PasswordTemplate
vtTrue, // Revert
vtOpt, // WritePasswordDocument
vtOpt, // WritePasswordTemplate
COLeVariant( 1L ),// Format = OpenFormatDocument
vtOpt, // Encoding
vtTrue, // Visible
vtFalse, // OpenAndRepair
vtOpt, // DocumentDirection
vtTrue, // NoEncodingDialog
vtOpt ); // XMLTransform

I suspect that it's that particular Word document causing this
(strange, I think) behaviour. But I'd like to be able to manage it...
I mean, I have to!

Thank you
Alessio


Cindy M -WordMVP- wrote in message news:VA.000098d0.01ae7c77@speedy...
Hi Alessio,

Please post the OpenDataSource method's code you're trying to use.

Note that there was a very important change in this method's syntax
starting with Word 2002. So you probably will need to either have two
procedures (one for 2000/97, another 2002 and later) or you will have to
use late binding for the Word object model.

It happens with a certain Word2003 mailmerge document: I open it using
Word2003 (through OLE), and a "Select Data Source" dialog box appears,
asking me to specify the data source path. If I manually cancel that
dialog box, then everything seems to work as usual (i.e., as Word2000
usually behaves), and the automation code works.
But, HOW CAN I AVOID THAT DIALOG BOX ?!?!? IT MAKES THE AUTOMATION
CODE HANG!!!


Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question
or reply in the newsgroup and not by e-mail :-)

  #4  
Old May 25th, 2004, 04:07 PM
Cindy M -WordMVP-
external usenet poster
 
Posts: n/a
Default AVOIDING "Select Data Source" dialog box?!?

Hi Alessio,

the point is that I'm not trying to open the data source. The method
I'm using, causing that dialog box to appear, is the Open method of a
Documents object (it's a VC++.NET application).

Ah, OK. Then the document doesn't "find" the data source; the cause of
this can vary, but that's no the important point, in your case...

Try setting the DisplayAlerts property of the Word application object
to "none" (it's a LONG value or a wd-enumeration constant, there are
three possibilities for the property)

Note, also, that this doesn't work for all earlier versions of Word.
Definitely not for 97; I can't remember exactly for 2000, but I think
not; should for 2002 and 2003)

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question
or reply in the newsgroup and not by e-mail :-)

  #5  
Old May 26th, 2004, 08:50 AM
Alessio
external usenet poster
 
Posts: n/a
Default AVOIDING "Select Data Source" dialog box?!?

Hi Cindy,
unfortunately I already set the DisplayAletrs property to none, but to
no avail.
I really think that the problem is in the document itself, and I
suspect that it depends on HOW the document was originally created.
(Unfortunately, I can't contact the author.)
Perhaps the following behaviours can help you find a solution; here is
what happens when I open the document MANUALLY:
First the "Select data source" dialog box appears.
1) If I select the data source file and confirm the dialog, then the
document is opened (along with the data source), and nothing more
happens (i.e., I can browse the mailmerge records, print them and do
anything I want, without being asked for anything else).
2) If I Cancel the dialog, then the usual dialog box carrying the two
buttons "Find data source..." and "Options..." is displayed; if I
choose "Find data source..." then the previous "Select data source"
dialog box appears, but when I select the same data source as in point
1, another dialog box is displayed: the "Select table" dialog box,
showing the following 6 items:

Sheet1$
Sheet1$Query_from_PRODXPDB_1
Sheet1$Query_from_PRODXPDB_2
Sheet1$Query_from_PRODXPDB_3
Sheet2$
Sheet3$

I choose Sheet1$, and everything works fine. So, what's the reason why
these two different behaviours occur? Does it helps you understanding
what's going on?

Thank you
Alessio

Cindy M -WordMVP- wrote in message news:VA.000098fb.009b245e@speedy...
Hi Alessio,

the point is that I'm not trying to open the data source. The method
I'm using, causing that dialog box to appear, is the Open method of a
Documents object (it's a VC++.NET application).

Ah, OK. Then the document doesn't "find" the data source; the cause of
this can vary, but that's no the important point, in your case...

Try setting the DisplayAlerts property of the Word application object
to "none" (it's a LONG value or a wd-enumeration constant, there are
three possibilities for the property)

Note, also, that this doesn't work for all earlier versions of Word.
Definitely not for 97; I can't remember exactly for 2000, but I think
not; should for 2002 and 2003)

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question
or reply in the newsgroup and not by e-mail :-)

  #6  
Old May 26th, 2004, 04:26 PM
Cindy M -WordMVP-
external usenet poster
 
Posts: n/a
Default AVOIDING "Select Data Source" dialog box?!?

Hi Alessio,

unfortunately I already set the DisplayAletrs property to none, but to
no avail.

The behavior you describe is well-known to me, and there are a number of
factors that could be the basic cause. But none of that is probably
going to be of much help to you, unless you can influence how these
kinds of files are going to be coming to you?

I just tested DisplayAlerts on a "forced case" in Word 2003 with an SP
beta and I see something else (even worse than you report).

At this point, the best I can do is point you to a Knowledge Base
article written originally for VB. It uses a Timer to "SendKeys" to an
application to dismiss the dialog box "hanging" it. Not a pretty sight,
but the only possibility. Try a Search on
"How to" AND "Office" AND "dismiss" AND "message"

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question
or reply in the newsgroup and not by e-mail :-)

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:06 PM.


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