Delete Object and Place Another in its place fails

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have an application I am building which places families onto grid lines. I approached the project by writing it as macros first. The macro code works great. Now I want to be able to check for existing families that have been placed by the macro so that I can delete them before placing another set of new ones. This is so that if the grids change the user can get a fresh set of families.
The problem I am running into is if I delete the families and then place new ones in their place it doesn't delete the families and I get the error about multiple families occupying the same location. My code to delete the families works great on its own, but when I try to run it within the other code that places the families it fails to delete them.
Is this something to do with how I am running transactions? I have tried putting the delete code in its own transaction and as a subtransaction, but neither work.Is there something that I need to do in order to get the objects deleted and the document to update before moving on to add the new families in the same location?
I can post code if needed, but I know the code for creation and deletion both work seperately. Just need some advice on why the deletion doesn't work when they are together.