*!* This example inserts first 10 recs from employee table *!* Bookmarks each as inserted *!* Moves odd recno() records to eof *!* Please notice that this is for word97 *!* Word.basic commands work unchanged in word95 & word97 (Those used here) *!* Some sections are commented to show the same syntax (or alternative) *!* for VB and wordbasic #Define NL Chr(13) Public oWordDocument *** set the LOCALEID to English nlLocaleId=Sys(3004) && Save local id =Sys(3006,1033) && We will be sending instructions in English Use employee && test table Wait Window Nowait "Creating Word Document..." oWordDocument=Createobject("word.application") && Create word object With oWordDocument.wordbasic .appshow && Show word app .filenewdefault && New file, default template Scan While Recno() <= 8 .formatfont(12,,6) && 12 points, red .editbookmark("b"+Alltrim(employee.emp_id),,1) && Add bookmark as emp_id * oWordDocument.activedocument.bookmarks.add(cBookmark) - VB syntax .Insert(Ltrim(Str(Recno()))+"-"+Trim(employee.last_name)+; ","+employee.first_name+NL) * Insert employee name - recno is just for us to track .formatfont(10,,5) && 10 points, Magenta .Insert(employee.notes+NL+NL) && Insert employee notes * Insert odd recs as selstart, even as selend into an array If Recno()%2 = 1 Dimension aBookMarksRange[; iif(type("aBookMarksRange")="U",1,; alen(aBookMarksRange,1)+1),2] Endif Store "b"+Alltrim(employee.emp_id) To ; ("aBookMarksRange[alen(aBookMarksRange,1),"+; Iif(Recno()%2=1,"1","2")+"]") Endscan Endwith If Type("aBookMarksRange")#"U" && Make sure bookmark array exist With oWordDocument.ActiveDocument && Use VB syntax instead of wordbasic For ix=1 To Alen(aBookMarksRange,1) If .Bookmarks.Exists(aBookMarksRange[ix,1]) ; and .Bookmarks.Exists(aBookMarksRange[ix,2]) && Are both defined ? .Range(.Bookmarks(aBookMarksRange[ix,1]).Range.Start, ; .Bookmarks(aBookMarksRange[ix,2]).Range.End).cut && cut range *!* .Range(.Bookmarks(aBookMarksRange[ix,1]).Range.Start, ; *!* .Bookmarks(aBookMarksRange[ix,2]).Range.End).select && Select range *!* oWordDocument.Selection.Cut && Cut selection oWordDocument.Selection.Goto(-1,,,"\EndOfDoc") && VB goto bookmark oWordDocument.Selection.Paste * Same word.basic way to cut and paste *!* oWordDocument.wordbasic.editcut && Wordbasic cut method *!* oWordDocument.wordbasic.endofdocument && Wordbasic goto eod *!* oWordDocument.wordbasic.editpaste && Wordbasic paste method Endif Endfor Endwith Endif Wait Clear **** Set the LocaleId to the previous value =Sys(3006,Val(nlLocaleId))PS: Though basic commands < g > shown in sample work in new object model behavior of some of commands have changed. Use New syntax wheneever possible. Help file has 'Visual Basic Equivalents for WordBasic Commands' entry.