Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
FrmDtt=(FD.GetContent.String)
FrmDate=">=" & month(FrmDtt) & "/" & Day(FrmDtt) & "/" & year(FrmDtt)
set TD = ActiveDocument.Variables("To date")
ToDtt=(TD.GetContent.String)
ToDate="<=" & month(ToDtt) & "/" & Day(ToDtt) & "/" & year(ToDtt)
if FrmDtt>ToDtt then
msgbox "Start Date Should be less than End Date"
else
ActiveDocument.Fields("T_DAY_DATE").Select FrmDate & ToDate
end if
end sub
Please help to resolve this issue..
Thanks
Sushil
When it opens the macro editor, does it highlight a specific line?
Can you post your qvw for examination?
You can msgbox at different lines to find which line the error is triggered. I think something is wrong with else part of your code. Check adding msgbox right after else.