Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

danilodct
Not applicable

Trying move over sheets using macro

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'){

                    ActiveDocument.Sheets('SH01').Activate

           }else{

                    var achou = false;

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

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

                                      achou = true;

                                      ActiveDocument.Sheets(i+1).Activate;

                             }

                    }

           }

}

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


for i = 0 to ActiveDocument.NoOfSheets - 1

     ActiveDocument.Sheets(ActiveDocument.Sheets(i).GetProperties.Name).Activate

     ActiveDocument.GetApplication.WaitForIdle

     ActiveDocument.GetApplication.Sleep 5000

next

Does anyone can help me?

1 Solution

Accepted Solutions
maxgro
Not applicable

Re: Trying move over sheets using macro

4 Replies
luciancotea
Not applicable

Re: Trying move over sheets using macro

marcus_sommer
Not applicable

Re: Trying move over sheets using macro

The bottom vbs-part worked with the APIGuide.qvw as test-app very well. When your app crashed what happens - high CPU activities and/or there is a hig RAM increasing or nothing? Runs it a few sheets or crashed it before?

- Marcus

maxgro
Not applicable

Re: Trying move over sheets using macro

danilodct
Not applicable

Re: Trying move over sheets using macro

Thanks Man!