4 Replies Latest reply: Feb 26, 2015 2:49 PM by Danilo Torres RSS

    Trying move over sheets using macro

    Danilo Torres

      Hi guys, i just wanna change the active sheet which 3 seconds. I think the only way to do that is using macro. So i tried this code below but it doesn't works.

      function run(){

              setInterval(alterarAba, 3000);




      function alterarAba(){

               var sheetIDAtual = ActiveDocument.ActiveSheet.GetProperties.SheetId;

                 if(sheetIDAtual == 'SH03'){



                          var achou = false;

                          for(var i = 0; i < ActiveDocument.NoOfSheets - 1 && !achou; i += 1){

                                   if(ActiveDocument.Sheets(i).GetProperties.SheetID == sheetIDAtual){

                                            achou = true;






      I also tried the code below as i saw at this discussion: Trying to Loop through Sheets in a Dashboard Continually but the application crashed. I think is the WaitForIdle function:

      for i = 0 to ActiveDocument.NoOfSheets - 1



           ActiveDocument.GetApplication.Sleep 5000



      Does anyone can help me?