#define true .t. #define false .f. #define cr chr(13) use test go top oword=create('word.application') if not file('d:\vfplibrary\word\affidavit of complaint.dot') wrdfile=getf('','Affidavit','Get') else wrdfile='d:\vfplibrary\word\affidavit of complaint.dot' endif oword.documents.open(wrdfile) oword.caption='Word97 Affidavit' lcoffense=offense lcdefendant=allt(def_fname)+' '+allt(def_lname) lcaction='arrest' if def_sex $'Mm' lchimher='him' else lchimer='her' endif oword.ACTIVEDOCUMENT.Bookmarks("AFFIANT1").SELECT oword.SELECTION.insertafter(affiant) oword.ACTIVEDOCUMENT.Bookmarks("AFFIANT1ADDRESS").SELECT oword.SELECTION.insertafter(aff_addres) *************** oword.ACTIVEDOCUMENT.Bookmarks("warrantoffense").SELECT oword.SELECTION.insertafter(lcoffense) ****************************** Application.top = 140 Application.left = 245 Application.width = 380 Application.height = 270 oword.top = 1 oword.left = 1 oword.width = 180 oword.height = 260 oword.visible= .t. *oword.activedocument.CheckSpelling application.visible= .t. **** Currently you have to use wordbasic to do the printing. **** vba's print method isn't supported in versions prior to VFP 6. **** However, vba print preview is . . . *Oword.activedocument.PrintPreview *** print the current document cMessageTitle = 'Print?' cMessageText = 'Print this document?' nDialogType = 4 + 32 + 256 * 4 = Yes and No buttons * 32 = Question mark icon * 256 = Second button is default nAnswer = MESSAGEBOX(cMessageText, nDialogType, cMessageTitle) if nanswer=7 llprint=.f. else llprint=.t. endif if llprint oWord.WordBasic.FilePrint(.t.,,,,,,,1) endif **** Currently you have to use wordbasic to save the file. **** vba's saveas and save methods aren't supported. *** save the file as whatever cMessageTitle = 'Save?' cMessageText = 'Save this document?' nDialogType = 4 + 32 + 256 * 4 = Yes and No buttons * 32 = Question mark icon * 256 = Second button is default nAnswer = MESSAGEBOX(cMessageText, nDialogType, cMessageTitle) if nanswer=7 llsave=.f. else llsave=.t. endif *!* For this demo I'm saving the file dynamically by using the *!* system time as the file name and storing it in the root directory *!* of the c: drive. Make your adjustments to suit your needs. if llsave lcfile='c:\'+AFFTEST.DOC' oword.wordbasic.filesaveas(lcfile) endif