-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
What is the result of a call to Range.find() when the searched text is not found? #1785
Comments
Hi @ChemMitch, Yes, that is the expected behavior. There's a comment to that effect in the [Range.find sample(https://learn.microsoft.com/en-us/javascript/api/excel/excel.range?view=excel-js-preview#excel-excel-range-find-member(1)). To avoid an error being thrown, you can instead use the Range.findOrNullObject method. That returns an object with The base description of Range.find should specific the error throwing. I'll leave this issue open until that's resolved. @alison-mk. could you please follow up with that? |
Thank you once again, Alex! A follow-up question. Given this code export async function getVocabularySheet(workbook: Excel.Workbook): Promise<Excel.Worksheet> { this error occurs: The property 'isNullObject' is not available. Before reading the property's value, call the load method on the containing object and call "context.sync()" on the associated request context. But I'm doing what they say! I've tried calling So, what's the correct way to access isNullObject? |
Hi @ChemMitch, That should be working. I put your code into Script Lab and it seems to be working fine. Here's the gist. |
@ChemMitch You need to for example
|
Thanks, @junaid042 . I did that but got the error anyhow. |
You never need to load Please import Alex's gist into Script Lab and see if it works for you. |
I can run Alex's gist in script lab fine. |
The code in your earlier comment shows that you are calling isNullObject on a Worksheet object, not a Range object. |
Hello MIcrosoft Team,
I'm using the find method to look for text and seeing a RichApi.Error with code ItemNotFound.
Is that the expected behavior when the specified text is not found?
Thanks in advance!
Document Details
⚠ Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.
The text was updated successfully, but these errors were encountered: