Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Document_Open fails on open, but not on re-run

11 views
Skip to first unread message

jonas....@knowit.se

unread,
Feb 11, 2008, 9:44:55 AM2/11/08
to
Hi,

I have a Word document that originally is generated by SoftArtisans
OfficeWriter. However, I do not believe that has anything to do with
my problems, as they still exists even though I save the document
locally.

I have a Document_Open macro which among other things finds a specific
bookmark, selects it and removes a given number of tables from the end
of that bookmark like

For ii = Selection.Tables.Count To iFirstEmptyTable Step -1
Selection.Tables(ii).Delete
Next

When I open my document either by double clicking it or from withing
MS Word 2002 it fails with an error stating that the table i try to
delete does npt exist. The strange thing is that when I undo my way
back to the state where the macro started and try to run the same
macro again it all works! It is only when it really runs due to a
Document_Open that it fails.

As I use SoftArtisans you might guess that I generate these documents
from a Word template and some database data and the document works
perfectly in 9 cases out of 10. But for some cases, and I can't eally
figure out under which conditions, the macro fails. Some kind of
timing issue or what?

I'm grateful for any kind of ideas.

Regards,

Jonas B

0 new messages