2 Replies Latest reply: Jul 8, 2009 1:01 AM by Sergio Alonso Bueno RSS

    Macro Question

    patdanderson

      I am trying to write a macro that will automatically select the last 13wks when a button is clicked.

      I have tried

       

       

      [ ActiveDocument.Fields(

      "PickupWkStart"). Select ">=weekstart(Today(), 0, -1)-13"] ]



      I found this selects every week availabel not just the ones i want. Any ideas?

      The PickupWkStart field is just teh sunday of the week in standard MM/DD/YYYY format.

       

      Thanks

        • Macro Question

          Hello Pat,

          This macro will selesct the last 13 weeks of the current year.

          sub week13
          ActiveDocument.GetField("Year").Select ActiveDocument.Evaluate("year(today(1))")
          ActiveDocument.GetField("week").Select ActiveDocument.Evaluate("'>' & num(week(today(1))-13) & '<=' & num(week(today(1)))")
          end sub