Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Selection based on Input

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

1 Solution

Accepted Solutions
CELAMBARASAN
Partner - Champion
Partner - Champion

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

View solution in original post

2 Replies
CELAMBARASAN
Partner - Champion
Partner - Champion

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

Anonymous
Not applicable
Author

Works Perfectly!!!

Thanks