*!* 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() <= 10 .formatfont(12,,6) && 12 points, red .editbookmark("b"+Alltrim(employee.emp_id),,1) && Add bookmark using emp_id * oWordDocument.activedocument.bookmarks.add(cBookmark) - VB syntax *!* lcBkmark = "b"+alltrim(employee.emp_id) *!* lcBkmarkvalue = ltrim(str(recno()))+"-"+trim(employee.last_name)+","+employee.first_name *!* ? lcBkmark, lcBkmarkValue *!* .setformresult(lcBkmark,lcBkmarkValue) .Insert(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 they both defined ? .Range(.Bookmarks(aBookMarksRange[ix,1]).Range.Start, ; .Bookmarks(aBookMarksRange[ix,2]).Range.End).cut && Select & 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 *oWordDocument.wordbasic.setformresult(.Bookmarks(aBookMarksRange[ix,1]),; 5+8+9,1) Endfor Endwith #Define msoShapeRectangle 1 #Define msoShapeOval 9 #Define msoCallOutTwo 2 #Define msoCallOutThree 3 With oWordDocument.ActiveDocument.Shapes .AddShape(msoShapeRectangle, 50, 100, 100, 200) With .AddCallout(msoCallOutTwo, 200, 170, 170, 40) .TextFrame.TextRange.Text = "My rectangle" With .Callout .Accent = .T. .Border = .F. Endwith Endwith With .AddCallout(msoCallOutThree, 320, 170, 170, 40) .TextFrame.TextRange.Text = "My callout 3" With .Callout .Accent = .T. .Border = .T. Endwith Endwith Endwith Endif Wait Clear **** Set the LocaleId to the previous value =Sys(3006,Val(nlLocaleId))Cetin