Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I want to do this: A user type in a field value to search in an input box and a macro defines what needs to be searched.
In example: the user types in C and 3 searches will be defined:
C,
*,C*
*C,*
I want to do this because when the user searches for C I don't want to include VC CS, etc, I just want C and C in a comma separated list.
The data source is a mess so sometimes a value is correct but someothers a row groups different values in a list (comma separated).
Can you guys help me?
Igor Alcantara wrote:Another question regarding to this: how can I apply more than 1 search at the same time?
That part I can answer. Look for "advanced search" in the help. In this case, you could use this:
=wildmatch(MyField,'C,','*,C*','*C,*')
Not sure about the macro itself, though.
Another question regarding to this: how can I apply more than 1 search at the same time?
Igor Alcantara wrote:Another question regarding to this: how can I apply more than 1 search at the same time?
That part I can answer. Look for "advanced search" in the help. In this case, you could use this:
=wildmatch(MyField,'C,','*,C*','*C,*')
Not sure about the macro itself, though.
Can I use that in the Search Object also?
Igor Alcantara wrote:Can I use that in the Search Object also?
Looks like the answer is "no" - you can't combine Advanced Search with a Search Object. Unfortunate. I can see how it wouldn't work for something like the expression I gave, since it explicitly lists a field name, though even then, why not at least return matches in that field? But I also tried something without a field name, like sum("Hours")>100. It works just fine in a normal search, but returns no results in a search object.
Ok, I'll try that. Thanks.
Is it possible to loop a Selection List and possibibly change the selected values?
I suppose you could with a macro.
Edit: ...which isn't a very useful answer. You'll need to look at the API guide, but here are some possibly-useful tidbits:
ActiveDocument.Fields("MyField").getSelectedValues
ActiveDocument.Fields("MyField").getSelectedValues.Count
ActiveDocument.Fields("MyField").getDeselectedValues
ActiveDocument.Fields("MyField").ToggleSelect "Some Value"
One more question: Can I create a Bookmark in a macro? If so, what is the code I can use for that?
Also, getSelectedValues and getDeselectedValues return both zero if I have no value selected. I need to know and loop through all possible values in a field. Any other guess?