Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello everyone,
I know macros are bad and i should not use them..
But i have to know this.
Can anyone help me with the syntax of macro to select latest 12 months from a date dimension.
ActiveDocument.Fields("ShipDate","State-A").Select ActiveDocument.Evaluate("date(date#(addmonths(max(ShipDate),-12),'DD-MM-YYYY'),'DD-MM-YYYY')")
The above helps me select max-12 month.
But i want to select all last 12 months?
Thanks
khushboo
Try this:
ActiveDocument.Fields("ShipDate","State-A").Select ">=" & ActiveDocument.Evaluate("date(date#(addmonths(max(ShipDate),-12),'DD-MM-YYYY'),'DD-MM-YYYY')")
- Marcus
Try this:
ActiveDocument.Fields("ShipDate","State-A").Select ">=" & ActiveDocument.Evaluate("date(date#(addmonths(max(ShipDate),-12),'DD-MM-YYYY'),'DD-MM-YYYY')")
- Marcus
Thanks Marcus 🙂