FindUsingPoint runtime error 5
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I have a VBA macro that goes through all sheets and all Balloons (Item numbers), and fixes them if they became detached. It does it by getting the Leader point on the sheet and then finds drawing curves around that point, using the Sheet.FindUsingPoint function.
However, sometimes, I get a Run-Time Error 5 Invalid Procedure Call Or Argument on this line. The function is called on the active sheet, the only Point2d paramter it takes is valid and is within the sheet boundaries, so I have no idea why it says invalid call? the only time I saw this is when the sheet wasn't fully updated, but I made sure the macro updates both the whole document and all sheets individually. (Sheet.Status is 0 immediately before this command call.)
The strange thing is, when the error occurs and I go to debug and simply continue running the macro, it repeats the same line with same parameter and works perfectly fine from here on.
But when I manually update all sheets before running the macro, it works perfectly fine, too. So I call the internal command DrawingUpdateAllSheetsCmd in sync mode to make sure the macro only continues when the drawing is really finished updating, but this didn't help either.
So my guess is, despite running updates and despite Sheet.Status is 0, the views are not done updating yet.
Why could this happen?