2 Replies Latest reply: Oct 7, 2011 1:34 PM by Kiran Rokkam RSS

    Problem to run macro with a button

    sushil kumar

      Hi all,


      I am using a macro to select a date range. i have created a button to run the macro but whenever i press the button, it opens up the macro editor window...


      the macro is :



      sub DataBetweenSelectedDate 'Used with the Variables , it filter the reports for two selected dates

      set FD = ActiveDocument.Variables("From date") '' variable for Initial date


      FrmDate=">=" & month(FrmDtt) & "/" & Day(FrmDtt) & "/" & year(FrmDtt)

      set TD = ActiveDocument.Variables("To date")


      ToDate="<=" & month(ToDtt) & "/" & Day(ToDtt) & "/" & year(ToDtt)

      if FrmDtt>ToDtt then

      msgbox "Start Date Should be less than End Date"


      ActiveDocument.Fields("T_DAY_DATE").Select FrmDate   &   ToDate

      end if

      end sub



      Please help to resolve this issue..