>PUBLIC ow as word.application >oWordEvents = NEWOBJECT("WordEvents") >ow = NEWOBJECT("word.application") >oWordEvents.ow = ow >?"Word",EVENTHANDLER(ow,oWordEvents) >ow.visible = .t. >ow.Activate >ow.Documents.Add > >_screen.WindowState= 1 > >DEFINE CLASS WordEvents as Custom > implements applicationevents2 in "word.application" > ow = .null. > PROCEDURE applicationevents2_startup() > ?PROGRAM() > PROCEDURE applicationevents2_quit > ?PROGRAM() > procedure applicationevents2_DocumentBeforeClose(Cancel,Doc) > ?PROGRAM() > procedure DocumentBeforeClose(Cancel,Doc) > ?PROGRAM() > procedure applicationevents2_DocumentBeforePrint(Cancel,Doc) > ?PROGRAM() > procedure applicationevents2_DocumentBeforeSave(Doc,SaveAsUI,Cancel) > ?PROGRAM() > procedure applicationevents2_DocumentChange > ?PROGRAM() > procedure applicationevents2_DocumentOpen(Doc) > ?PROGRAM() > procedure applicationevents2_NewDocument(Doc) > ?PROGRAM() > procedure applicationevents2_WindowActivate(Doc,Wn) > ?PROGRAM() > procedure applicationevents2_WindowBeforeDoubleClick(Sel,Cancel) > ?PROGRAM() > procedure applicationevents2_WindowBeforeRightClick(Sel,Cancel) > ?PROGRAM() > procedure applicationevents2_WindowDeactivate(Doc,Wn) > ?PROGRAM() > procedure applicationevents2_WindowSelectionChange(Sel) > ?PROGRAM(),sel.text > IF sel.start < sel.end > sel.InsertAfter("Fox!") >*!* mtmp = sel.text >*!* sel.text=STRTRAN(mtmp,"good","Great!") > endif > PROCEDURE destroy > ?PROGRAM() > IF !ISNULL(this.ow) > ?EVENTHANDLER(this.ow,this,.t.) > ENDIF >ENDDEFINE>When I run this code I get "Type library word.application not found" when it tries to create th oWordEvents object. I want to be able to return the name the user saved the document as so that I can attach it to a record in my application.