Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
m_seisbye
New Contributor

Macro stopped working

I have snatched this loop macro out on the great www.   and combined it with an export macro.  I have created a button with the run macro command.  Last month when I created this it worked perfectly.. Now suddenly i can't make it execute.   If i run the export macro on it's own. it's working fine.  so it must be the loop which is of somehow.   But have can it's suddenly stop working?  ( i have checked that allow system access is granted).  Are there other places where you by mistake can disable the security in qlik, so it dosn't work

The loop looks in the table i'm loading seperatly. i have made a listbox of all the values in it. it then selects the first. export, select next export etc.

What is wrong.  the code or some kind of security..  I'm almost 100% sure no one has altered the code. i have tried copying from new.  Checking the spelling of the macro name, the field name etc.

Sub Loops

MaxRow =  ActiveDocument.Variables("vNoofrows").GetContent.Value

For x = 0 to MaxRow

    set mySelections = ActiveDocument.fields("Selection").GetSelectedValues(1)

    ActiveDocument.Fields("Selection").Clear

    if mySelections.Count = 0 then

  set val=ActiveDocument.Fields("Selection").GetPossibleValues(1)

  ValueToSelect = val.Item(0).Text

    else

set val=ActiveDocument.Fields("Selection").GetPossibleValues

IamDone = " "

for i=0 to val.Count-1

ValueToSelect = val.Item(i).Text

if IamDone = "X" then

exit for

end if

if val.Item(i).Text = mySelections.Item(0).text then

IamDone = "X"

end if

'Call exportToExcel_Variant2

next

  end if

   ActiveDocument.Fields("Selection").Select ValueToSelect

Call exportToExcel_Variant2

Next

End Sub

2 Replies
tajmohamed30
Contributor III

Re: Macro stopped working

pls try recreating it new with the sample app

m_seisbye
New Contributor

Re: Macro stopped working

nice and scrampled sample now attached

Community Browser