Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have created a macro, which selects two variables and attempts to select a date range in a field, but it does not work.
Here is the macro:
sub DataBetweenSelectedDate()
set FD = ActiveDocument.Variables("FromDate") '' variable for Initial from date
FrmDtt=(FD.GetContent.String)
set TD = ActiveDocument.Variables("ToDate") '' variable for Initial to date
ToDtt=(TD.GetContent.String)
FrmDate=">=" & Day(FrmDtt) & "/" & month(FrmDtt) & "/" & year(FrmDtt)
msgbox FrmDate
ToDate ="<=" & Day(ToDtt) & "/" & month(ToDtt) & "/" & year(ToDtt)
msgbox ToDate
toSelect = FrmDate & ToDate
msgbox toSelect
ActiveDocument.Fields("Start_Date").Select toSelect ''
end sub
The message boxes in order state: '>=1/12/2010', '<=31/12/2010', '>=1/12/2010<=31/12/2010'
Does anyone know why this does not select anything in the Start_Date field?
hi,
Instead of Macro you can use the required the date selection in expression.
Please find a sample attachment for the same.
Deepak