Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have a macro:
sub selectYear
msg = inputbox("Please Enter Year: ")
ActiveDocument.Fields("ThemeDate").Select "*/*/msg*"
end sub
when the user types "2011" all entries for the year 2011 should show, but it does not.
But when I have :
sub selectYear
msg = inputbox("Please Enter Year: ")
ActiveDocument.Fields("ThemeDate").Select "*/*/2011*"
end sub
the macro works,
I know it has to do with the input, do I have to trim(take away trailing whitespace) it or something like that.
Kind Regards
Razak
Hi,
Try with his
sub selectYear
msg = inputbox("Please Enter Year: ")
ActiveDocument.Fields("ThemeDate").Select "*/*/" & msg & "*"
end sub
If you use variable name inside the double quotes then it take that as string(it looks for */*/msg* not */*/2011*).
Hope it helps
Celambarasan
Hi,
Try with his
sub selectYear
msg = inputbox("Please Enter Year: ")
ActiveDocument.Fields("ThemeDate").Select "*/*/" & msg & "*"
end sub
If you use variable name inside the double quotes then it take that as string(it looks for */*/msg* not */*/2011*).
Hope it helps
Celambarasan
Works Perfectly!!!
Thanks