Abrir Documentos deOffice

Hola a todos!!!
Como hago para abrir un archivo de word DESDE visual fox pro 6.0 por medio de comandos?
Gracias por la atencion prestada.

1 respuesta

Respuesta
1
Supongo que además necesitas la automatización, por lo que te remito un ejemplo que te enseña a hacer ambas cosas.
Por favor, estúdialo y ve que provecho puedes obtener de él.
Good, I suppose that you also need the automation, for what I remit you an example that becomes trained to make both things.
Please, study it and you see that profit can obtain of him.
***/ Begin program code /***
* Code to create a new data source to a VFP table.
*
* Use the Declare DLL function to prototype the
* SQLConfigDataSource function.
* Using SQLConfigDataSource prevents having to go into
* the ODBC Driver Manager and create the DSN.
***
DECLARE Integer SQLConfigDataSource in odbccp32.dll Integer, ;
Integer, String, String
***
* Create a string containing the settings appropriate to the driver.
* The following is an example for the Microsoft VFP ODBC driver
* accessing the Customer.dbf file.
***
*** Change the path below to point to the Customer table ***
*** in the \Samples\Data folder. ***
settings="DSN=visual foxpro tables"+chr(0)+;
"Description=VFP ODBC Driver"+chr(0)+;
"SourceDB=d:\vfp5a\samples\data"+chr(0)+;
"SourceType=DBF"
=SQLConfigDataSource(0,1,"Microsoft Visual FoxPro Driver",settings)
* NOTE: Ensure there are no spaces on either side of the equal sign (=).
ON ERROR DO errhand WITH ERROR(), MESSAGE(), MESSAGE(1), PROGRAM( ), LINENO( ) && Trap OLE & other errors.
* Initialize variables passed to Word to create form letter.
intro1="Congratulations! You are one of our best customers since you purchase $"
intro2=" each month from us. "
Intro3="As a result, your maximum order amount has been increased by $2500.00. If you have any questions, please feel free to contact us."
oWord = CREATEOBJECT("Word.Application")
WITH oWord
* Assign values to variables
dsname="D:\VFP\SAMPLES\DATA\customer.DBF"
wformat=0
wconfirmconv=0
wreadonly=0
wlinktosource=0
waddtofilelist=0
wpassworddoc=""
wpasswordtemp=""
wrevert=0
wprotectdoc=""
wprotecttemp=""
wconn="DSN=visual foxpro tables;uid=;pwd=;"+;
"sourcedb=d:\vfp\samples\data;sourcetype=dbf"+;
"exclusive=no;backgroundfetch=yes;collate=machine;"
wsqlstatement="SELECT contact,company,title,address,city,;
postalcode,STR(maxordamt,12,2) as maxordamt FROM customer ;
WHERE (customer.maxordamt>$100000)"
.Visible=.T. && Make Word visible.
.WindowState = 2 && Minimize Word.
.Documents.Add && Add new document.
.Selection.InsertParagraphAfter
.ActiveDocument.MailMerge.OpenDataSource;
(dsname,wformat,wconfirmconv,wreadonly,wlinktosource,;
waddtofilelist,wpassworddoc,wpasswordtemp,wrevert,;
Wprotectdoc, wprotecttemp, wconn, wsqlstatement)
.ActiveDocument.MailMerge.EditMainDocument
.Selection.InsertDateTime("dddd, MMMM dd, yyyy", 1)
.Selection.MoveRight
.Selection.InsertParagraphAfter
.Selection.MoveDown
.ActiveDocument.MailMerge.Fields.Add;
(OWord. Selection. Range,"contact")
.Selection.InsertParagraphAfter
.Selection.MoveDown
.ActiveDocument.MailMerge.Fields.Add;
(OWord. Selection. Range,"company")
.Selection.InsertParagraphAfter
.Selection.MoveDown
.ActiveDocument.MailMerge.Fields.Add;
(OWord. Sel

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas