Skip to main content
Announcements
See why Qlik is a Leader in the 2024 Gartner® Magic Quadrant™ for Analytics & BI Platforms. Download Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Macro Help

Any ideas on what is wrong with this?  It fails after the last ”end if”.  Thanks.

SUB SetSKU

vSKUCount = ActiveDocument.Variables("vSKUCount1").GetContent.string
vSKUDescCount =ActiveDocument.Variables("vSKUDescCount1").GetContent.string

set f = ActiveDocument.Fields("SKUToggle")

if vSKUCount = 1 or vSKUDescCount = 1 then
f.Select "Selected SKU"

else
if vSKUCount > 1 or vSKUDescCount > 1 then
f.Select "Multiple SKUs"
      
else
if  vSKUCount = 0 or vSKUDescCount = 0 then
f.Select "All SKUs"

end if
end if
end if

Call CreateSetAnalysis

END SUB

1 Solution

Accepted Solutions
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

I don't see anything wrong with your if/end if statements, although I suggest that you indent the code to more easily keep track of the if/end ifs.

But are you sure that it is the error is happening at the end if and not the call statement below. I would comment the call out and see if the error still occurs.

Regards

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein

View solution in original post

1 Reply
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

I don't see anything wrong with your if/end if statements, although I suggest that you indent the code to more easily keep track of the if/end ifs.

But are you sure that it is the error is happening at the end if and not the call statement below. I would comment the call out and see if the error still occurs.

Regards

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein