>Hi to whoever,
>
>I am working on a mail merge with word for windows. I have some
>visual basic script and not real sure on how to convert to vfp.
>Thanks... Eric
>
>
>ActiveDocument.MailMerge.OpenDataSource Name:= _
> "F:\APPS\MERGEDATA.DBF", _
> ConfirmConversions:=False, ReadOnly:=False,_
> LinkToSource:=True, _
> AddToRecentFiles:=False, PasswordDocument:="", _
> PasswordTemplate:="", _
> WritePasswordDocument:="", WritePasswordTemplate:="",_
> Revert:=False, _
> Format:=wdOpenFormatAuto, Connection:= _
> "DSN=FoxPro Files - Word;UID=;PWD=;
> SourceDB=F:\APPS;_
> SourceType=DBF;_
> Exclusive=No;_
> BackgroundFetch=Yes;_
> Collate=MACHINE;Null=Yes;Deleted=Yes;" _
> , SQLStatement:="SELECT * FROM MERGEDATA", SQLStatement1:=""
>Application.MailingLabel.DefaultPrintBarCode = False
>Application.MailingLabel.CreateNewDocument Name:="", _
> Address:="", AutoText _
> :="ToolsCreateLabels1", LaserTray:=wdPrinterManualFeed
In general you just write the parameters in VFP style,, so False corresponds to .f., instead of Wod constants you can substitute their values from VBA Help or, better use the Word constants header file which you can download from Files Section.
So this sample coul be translated to:
#INCLUDE w97const.h
oWord.ActiveDocument.MailMerge.OpenDataSource ("F:\APPS\MERGEDATA.DBF",.f.,.f.,.t.,.f.,"","","","",.f.,wdOpenFormatAuto, ;
"DSN=FoxPro Files - Word;UID=;PWD=;SourceDB=F:\APPS;SourceType=DBF;Exclusive=No;BackgroundFetch=Yes;Collate=MACHINE;Null=Yes;Deleted=Yes;","SELECT * FROM MERGEDATA","")
oWord.Application.MailingLabel.DefaultPrintBarCode = .f.
oWord.Application.MailingLabel.CreateNewDocument("","","ToolsCreateLabels1",wdPrinterManualFeed)
Nick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro
"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison