Johnny Andersson wrote:

Andrew Douglas Pitonyak <[EMAIL PROTECTED]> skrev den Sun, 10 Apr 2005 00:13:50 -0400:

<snip>

The following properties are supported:
STRING  ReplaceString
BOOL  SearchBackwards = False
BOOL  SearchByRow = False
BOOL  SearchCaseSensitive = False
BOOL  SearchRegularExpression = False
BOOL  SearchSimilarity = False
INTEGER  SearchSimilarityAdd = 2
INTEGER  SearchSimilarityExchange = 2
BOOL  SearchSimilarityRelax = False
INTEGER  SearchSimilarityRemove = 2
STRING  SearchString
BOOL  SearchStyles = False
INTEGER  SearchType = 0
BOOL  SearchWords = False

Are those values, mentioned above (for example SearchByRow=False), the default values, so if I don't mention them in my code, their values will be like those above?

I created a search descriptor and then I "inspected" it. These are the default values taht I received.


In my free macro document, I mention the SearchType. 0 means search the formula and 1 means search the value. I have not been able to find this documented any place else. I do not know off hand why I knew this so that I could document this. Oh yes, if you have my book, you will notice that in version 1.0.x, the SearchWords thing was not working.

I wonder if SearchType=2 means "search in notes"... I haven't had any time to test that yet... and I don't need that option at the moment...

I do not remember how I documented the SearchType, but it is not documented in the IDL. I might have read the source code...


Now it works and now I actually think I understand HOW it works. H19 is highlighted, just like I want it to and I feel very happy!

So I replace "Descriptor=CellRange.createSearchDescriptor()" by "Descriptor=Sheet.createSearchDescriptor()", just to see if it still works the same way, and it does!

So obviously your hint was not 100% correct, BUT it helped me anyway! It made me think...


So this is what I was looking for:

Sub SearchTest
    Dim Doc, Sheet, CellRange, Descriptor, Found As Object

    Doc=StarDesktop.CurrentComponent
    Sheet=Doc.Sheets.getByName("MySheet")

    Descriptor=Sheet.createSearchDescriptor()
    With Descriptor
        .SearchBackwards=False
        .SearchByRow=False
        .SearchCaseSensitive=True
        .SearchRegularExpression=False
        .SearchSimilarity=False
        .SearchString="Blah blah blah"
        .SearchStyles=False
        .SearchType=1 ' Search values
        .SearchWords=True
    End With
    CellRange=Sheet.getCellRangeByName("H3:H1000")
    Found=CellRange.findFirst(Descriptor)
    Doc.currentController.select(Found)
    Print Found.getString()
End Sub

Thank you very much for your help!

Your welcome...


-- Andrew Pitonyak My Macro Document: http://www.pitonyak.org/AndrewMacro.sxw My Macro Book: http://www.hentzenwerke.com/catalog/oome.htm Free Info: http://www.pitonyak.org/oo.php


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to