Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Word Merge Help...
Message
 
 
À
29/01/2008 08:45:41
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire de rapports & Rapports
Divers
Thread ID:
01286305
Message ID:
01352416
Vues:
28
Can somebody please check wdSendToNewDocument for me?

I can not get constants from the Object Reference, get this error
---------------------------
Microsoft Visual FoxPro
---------------------------
File access is denied c:\program files\microsoft visual foxpro 9\foxrefs.dbf.
---------------------------
OK   
---------------------------
>Another sample using VFPOLEDB.
>
>Wait Window Nowait "Creating Word Document.Please wait..."
>* Word constants header file
>#include "wdconst.h"
>#Define NL Chr(13)+Chr(10)
>m.lcConnection = "Provider=VFPOLEDB;Data Source="+_samples+'data\testdata.dbc'
>TEXT TO m.lcUDL TEXTMERGE noshow
>[oledb]
><<m.lcConnection>>
>ENDTEXT
>m.lcSource = Forcepath(Sys(2015)+'.udl',Sys(2023))
>Strtofile(m.lcUDL,m.lcSource)
>lcSQLStatement = "select first_name,last_name,title,hire_date,notes from employee"
>*** set the LOCALEID to English
>nlLocaleId=Sys(3004)  && Save local id
>=Sys(3006,1033)    && We will be sending instructions in English
>*** set the LOCALEID to English
>
>oWordDocument=Createobject("word.application") && Create word object
>With oWordDocument
>  .documents.Add
>  With .ActiveDocument.Mailmerge
>    .OpenDataSource(m.lcSource, wdOpenFormatAuto,,,.T.,,,,,,,m.lcConnection, m.lcSQLStatement)
>    .EditMainDocument	&& Activate the main document
>
>    * Write mailmerge as if not using a template
>    .Application.Selection.TypeText("Dear,"+Chr(13))
>    With .Application.Selection.Font
>      .Name = 'Times New Roman'
>      .Italic = .T.
>      .Size = 14
>    Endwith
>    .Fields.Add(.Application.Selection.Range, 'First_Name')
>    .Application.Selection.TypeText(',')
>    .Fields.Add(.Application.Selection.Range, 'Last_Name')
>    With .Application.Selection.Font
>      .Name = 'Times New Roman'
>      .Italic = .F.
>      .Size = 10
>    Endwith
>    .Application.Selection.TypeText(NL+NL+;
>      'Please update your info and send back. Current notes are as follows:'+;
>      NL+NL)
>    With .Application.Selection.Font
>      .Name = 'Arial'
>      .Size = 12
>      .Color = Rgb(0,0,255)
>    Endwith
>    .Fields.Add(.Application.Selection.Range, 'Notes')
>    * Write mailmerge as if not using a template
>
>    * Send to a new doc - to check what we get
>    .Destination = wdSendToNewDocument
>    .Execute
>  Endwith
>  .Visible = .T.   && Show word app
>  .Activate
>Endwith
>Wait Clear
>Erase (m.lcSource)
>**** Set the LocaleId to the previous value
>=Sys(3006,Val(nlLocaleId))
>
Cetin
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform