1 Reply Latest reply: Sep 30, 2011 3:04 PM by James Gilpin RSS

    Macro vbscript to set range between day 1 and today

      I would like to select records starting from the 1st day of the month to the current day of the month.
      My first attempt:
      Sub firstSel
      Set q = ActiveDocument
      q.ClearAll (True)
      Set f1=q.GetField("AV_FLOW_YEAR")
      f1.select("2011")
      Set f2=q.GetField("AV_FLOW_MONTH")
      f2.select("09")
      Set f3=q.GetField("DAY")
      f3.select(">=1 <=today()")
      'would like to set range to be >=1 <=today()
      End sub
      However, today is not a value in vbScript
      Have tried datepart, to no avail
      James
        • Macro vbscript to set range between day 1 and today

          Sub firstSel
          Set q = ActiveDocument
          q.ClearAll (True)
          Set f1=q.GetField("AV_FLOW_YEAR")
          f1.select("2011")
          Set f2=q.GetField("AV_FLOW_MONTH")
          f2.select("09")
          Set f3=q.GetField("DAY")
          f3.select(">=1 <="&datepart("d",now()))
          'would like to set range to be >=1 <=today()
          End sub

           

           

          Looks like I found the answer, by using the & to append the value to the string expression used for the search criteria