Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

vb script help

Hi everyone

I need some help in vbscript

I have two fields Date and Sales

I create a variable as vStartDate and one as vEndDate.I want to create a button which sum Sales from vStartDate  to vEndDate.

This is my script

sub calc

set q = ActiveDocument

q.ClearAll (True)

Set f1=q.GetField("DATE")

Set v1 = ActiveDocument.Variables("vStartDate")

v=v1.GetContent.String

Set w1 = ActiveDocument.Variables("vEndDate")

w=w1.GetContent.String

f1.select(">=v <w")

end sub

But it does nothing.Could anyone help me.

Labels (1)
6 Replies
rajeshvaswani77
Specialist III
Specialist III

You need to adjust the security. Also give just a msgbox and see if it pops up. Your macro may not be running.

m_woolf
Master II
Master II

This line: 

f1.select(">=v <w")

needs to be something like this:

f1.select(">=" & v & "<w")

Not applicable
Author

I give a msgbox and i works fine it gives me back the vStartdate and then the vEndDate. So i suppose th error is in

f1.select(">=v <w")

end sub

How can configure my security?

m_woolf
Master II
Master II

security is set in the module editor. Yours is probably fine, since your msgbox works ok.

Not applicable
Author

In  this statement it works only ">=" and not <

f1.select(">=" & v & "<w")

I tried to fix it but i cannot

Not applicable
Author

I fix it thanks a lot for your advices ..........