Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Word with Variable DataSource
Message
 
À
21/03/2002 09:16:43
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00635395
Message ID:
00635454
Vues:
17
>>Cetin,
>>
>>I've been trying this but I keep getting the OpenDataSource Dialog coming up when I open the document. This requires use action so I can't set the source in the code as it never get to that line. Any suggestions now to stop the dialog coming up?
>
>Caroline,
>I do like this and get no dialog :
>
>
*Create and save the template routine
>#define wdFormatTemplate  1
>lcMYDBC = 'c:\myPath1\myDbc.dbc'
>cSQLStatement1 = "SELECT * FROM employee"
>cSQLStatement2 = ""
>
>oWordDocument=createobject("word.application")	&& Create word object
>With oWordDocument
>  .Documents.Add && Use a predefined template
>  .ActiveDocument.SaveAs(sys(5)+curdir()+'mytemplate.dot', wdFormatTemplate)
>  With .ActiveDocument.MailMerge
>    .OpenDataSource(,,,.T.,,,,,,,, ;
>      "DSN=Visual FoxPro Database;SourceDB="+lcMYDBC+;
>      ";SourceType=DBC;Exclusive=No;",;
>      cSQLStatement1, cSQLStatement2) && Open data source - Link to source
>    .EditMainDocument && Activate the main document
>  Endwith
>  .Visible = .t.
>Endwith
>
>* User modified and saved the template
>* Merge routine
>lparameters tcMyDBC && Might be from a different path
>#Define wdSendToNewDocument  0
>cSQLStatement1 = "SELECT * FROM employee where title like [Sales%]"
>cSQLStatement2 = ""
>
>oWordDocument=createobject("word.application")	&& Create word object
>With oWordDocument
>  .Documents.Add(sys(5)+curdir()+'mytemplate.dot') && Use a predefined template
>  With .ActiveDocument.MailMerge
>    .OpenDataSource(,,,.T.,,,,,,,, ;
>      "DSN=Visual FoxPro Database;SourceDB="+tcMyDBC+;
>      ";SourceType=DBC;Exclusive=No;",;
>      cSQLStatement1, cSQLStatement2) && Open data source - Link to source
>    .Destination = wdSendToNewDocument
>    .Execute
>  Endwith
>  .Visible = .t.
>Endwith
>
>Cetin

Cetin,

Sorry to be a pain :) but if you create the template (which has been saved with a DataSource location) and then physically rename the directory the data file is in. Then Add from the template do you get the OpenSource Dialog?
Caroline
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform