Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
You need to adjust the security. Also give just a msgbox and see if it pops up. Your macro may not be running.
This line:
f1.select(">=v <w")
needs to be something like this:
f1.select(">=" & v & "<w")
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?
security is set in the module editor. Yours is probably fine, since your msgbox works ok.
In this statement it works only ">=" and not <
f1.select(">=" & v & "<w")
I tried to fix it but i cannot
I fix it thanks a lot for your advices ..........