bonjour à tous,
j'ai programmé une macro qui ouvre un fichier et manipule les données. Cette première macro en appelle une autre, qui utilise aussi ce même fichier. Mais le problème, c'est que je ne veux pas ouvrir une deuxième fois le doc, et si je ne l'ouvre pas une deuxième fois, il n'est pas reconnu, même si ma déclaration est globale. Quelqu'un peut-il m'expliquer ce que je peux faire ? (j'ai copier ci-dessous une partie des macros)


option explicit
global entree as object

Sub Validation
entree = StarDesktop.LoadComponentFromURL(ConvertToURL("Z:\SIME\SIME\entrees.ods"), "_blank", 0, prop) Calc1 = StarDesktop.LoadComponentFromURL(ConvertToURL("Z:\SIME\SIME\calc1.ods"), "_blank", 0, prop)
cellule = entree.sheets(3).GetCellByPosition(0,cellule.CellAddress.row -1)

if cellule.Value = 0 then
   for i = 1 to n-1
entree.sheets(3).GetCellByPosition(2,i+3).Value = Calc1.sheets(0).GetCellByPosition(1,i+1).Value entree.sheets(3).GetCellByPosition(0,i+3).Value = Calc1.sheets(0).GetCellByPosition(0,i+1).Value entree.sheets(3).GetCellByPosition(1,i+3).Value = CDateToIso(date) entree.sheets(3).GetCellByPosition(11,i+3).Value = Calc1.sheets(0).GetCellByPosition(9,i+1).Value semaine(entree.sheets(3).GetCellByPosition(0,i+3))
  next
end sub

option explicit

Sub semaine (cellule as object)
for i = 1 to n
if entree.sheets(3).GetCellByPosition(0,cellule.CellAddress.row).Value = entree.sheets(1).GetCellByPosition(0,i).Value then sortie.sheets(0).GetCellByPosition(1,cellule.CellAddress.row-1).String = entree.sheets(1).GetCellByPosition(1,i).String
       nbeleve = entree.sheets(1).GetCellByPosition(3,i).Value
       shon = entree.sheets(1).GetCellByPosition(4,i).Value
       shob = entree.sheets(1).GetCellByPosition(5,i).Value
       exit for
   end if
next

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Répondre à