 category oobasiccode  site   autor  dannyb there areu800 three objects that youu800 typically associate with au800 document. there isu800 #theu800 document model #theu800 document controller #theu800 document frame. when youu800 need tou800 dou800 something tou800 au800 document youu800 need oneu800 ofu800 these three objects. which oneu800 ofu800 theu800 three youu800 need depends onu800 what youu800 intend tou800 dou800. calling loadcomponentfromurl always gives youu800 theu800 document model object. ooou800 basic also hasu800 au800 variable called thiscomponent which returns theu800 document model ofu800 theu800 document that contains theu800 currently running macro code. sou800 using either technique loadcomponentfromurl oru800 thiscomponent always results inu800 theu800 document model. sometimes foru800 instnace tou800 useu800 theu800 dispatcher youu800 need theu800 document frame. other times youu800 need theu800 document controller foru800 instance tou800 manipulate which shapes ofu800 au800 drawing areu800 selected . theu800 following three functions from myu800 library areu800 howu800 iu800 easily move between theu800 three different objects. '############################################################ ' apiu800 navigation convenience '############################################################ '---------- ' this will always return theu800 document document'su800 controller. ' pass inu800 anyu800 oneu800 ofu800... ' theu800 document document'su800 model subclass ofu800 comu800u82esunu800u82estaru82edocumentu82eofficedocument ' theu800 document document'su800 controller ' theu800 document document'su800 frame function getdocumentcontroller odoc asu800 object asu800 object dimu800 octrl asu800 object ' ifu800 theu800 caller gave usu800 theu800 document model... ifu800 odocu82esupportsservice comu800u82esunu800u82estaru82edocumentu82eofficedocument then ' ...then getu800 theu800 controller from that. octrl odocu82egetcurrentcontroller ' ifu800 theu800 caller gave usu800 au800 document controller... elseif hasunointerfaces odoc comu800u82esunu800u82estaru82eframeu82excontroller then ' ...thanks that that'su800 just what weu800 wanted octrl odoc ' ifu800 theu800 caller gave usu800 theu800 document frame... elseif hasunointerfaces odoc comu800u82esunu800u82estaru82eframeu82exframe then oframe odoc ' ...then getu800 theu800 controller from theu800 frame. octrl oframeu82egetcontroller else ' theu800 caller didu800 notu800 give usu800 what weu800 expected msgbox getdoccontroller called with incorrect parameter. endif getdocumentcontroller octrl endu800 function '---------- ' this will always return theu800 document document'su800 frame. ' pass inu800 anyu800 oneu800 ofu800... ' theu800 document document'su800 model subclass ofu800 comu800u82esunu800u82estaru82edocumentu82eofficedocument ' theu800 document document'su800 controller ' theu800 document document'su800 frame function getdocumentframe odoc asu800 object asu800 object dimu800 oframe asu800 object ' ifu800 theu800 caller gave usu800 theu800 document model... ifu800 odocu82esupportsservice comu800u82esunu800u82estaru82edocumentu82eofficedocument then ' ...then getu800 theu800 controller from that. octrl odocu82egetcurrentcontroller ' ...then getu800 theu800 frame from theu800 controller. oframe octrlu82egetframe ' ifu800 theu800 caller gave usu800 au800 document controller... elseif hasunointerfaces odoc comu800u82esunu800u82estaru82eframeu82excontroller then octrl odoc ' ...then getu800 theu800 frame from theu800 controller. oframe octrlu82egetframe ' ifu800 theu800 caller gave usu800 theu800 document frame... elseif hasunointerfaces odoc comu800u82esunu800u82estaru82eframeu82exframe then ' ...thanks that that'su800 just what weu800 wanted oframe odoc else ' theu800 caller didu800 notu800 give usu800 what weu800 expected msgbox getdocumentframe called with incorrect parameter. endif getdocumentframe oframe endu800 function '---------- ' this will always return theu800 document document'su800 model. ' pass inu800 anyu800 oneu800 ofu800... ' theu800 document document'su800 model subclass ofu800 comu800u82esunu800u82estaru82edocumentu82eofficedocument ' theu800 document document'su800 controller ' theu800 document document'su800 frame function getdocumentmodel odoc asu800 object asu800 object dimu800 odocmodel asu800 object ' ifu800 theu800 caller gave usu800 theu800 document model... ifu800 odocu82esupportsservice comu800u82esunu800u82estaru82edocumentu82eofficedocument then ' ...thanks that that'su800 just what weu800 wanted odocmodel odoc ' ifu800 theu800 caller gave usu800 au800 document controller... elseif hasunointerfaces odoc comu800u82esunu800u82estaru82eframeu82excontroller then octrl odoc ' ...then getu800 theu800 model from theu800 controller. odocmodel octrlu82egetmodel ' ifu800 theu800 caller gave usu800 theu800 document frame... elseif hasunointerfaces odoc comu800u82esunu800u82estaru82eframeu82exframe then oframe odoc ' ...then getu800 theu800 controller from theu800 frame. octrl oframeu82egetcontroller ' ...then getu800 theu800 model from theu800 controller. odocmodel octrlu82egetmodel else ' theu800 caller didu800 notu800 give usu800 what weu800 expected msgbox getdocumentmodel called with incorrect parameter. endif getdocumentmodel odocmodel endu800 function nowu800 iu800 canu800 dou800 something like... odoc loadcomponentfromurl ..... then later iu800 need theu800 frame iu800 canu800 just call... odocframe getdocumentframe odoc theu800 above code provides three functions... function getdocumentmodel odoc asu800 object asu800 object function getdocumentcontroller odoc asu800 object asu800 object function getdocumentframe odoc asu800 object asu800 object allu800 three functions accept anyu800 ofu800 theu800 model frame oru800 controller. each function will convert tou800 theu800 desired object. foru800 instance ifu800 iu800 need theu800 model iu800'llu800 call getdocumentmodel butu800 iu800 canu800 pass itu800 theu800 model theu800 frame oru800 theu800 controller. obviously ifu800 iu800 pass theu800 document model tou800 getdocumentmodel itu800 doesn'tu800 have tou800 dou800 anything butu800 just return what iu800 gave itu800. where these routines areu800 really useful isu800 inu800 writing more general subroutines. iu800 could write au800 routine tou800 sayu800 copy tou800 theu800 clipboard. theu800 routine takes au800 single parameter odoc. butu800 youu800 could pass inu800 anyu800 ofu800 theu800 three objects model controller frame . this makes myu800 clipboardcopy function easier tou800 call. youu800 just pass itu800 whichever ofu800 theu800 three document objects that youu800 conveniently have onu800 hand. ifu800 internally theu800 clipboardcopy function needs au800 frame then itu800 will useu800 myu800 getdocumentframe function tou800 getu800 theu800 frame from whichever oneu800 ofu800 theu800 three youu800 passed itu800. hope this isu800 helpful tou800 someone. 