A
Alexander Mueller
Hi @ all
i want to copy a document and then remove some parts of it.
I do the copy with WordBasic.CopyFileA, since VBA.FileCopy
fails on opened docs.
After having copied the file, I open it using
Documents.Open in invisible manner.
Then I want to remove the first part of the document , from the
very beginning to one char before a certain bookmark
I use the following code
Set oRng = oNewDoc.Range(0, oNewDoc.Bookmark("bmname").Start - 1)
oRng.Delete
However i get error 5904, "Cannot edit range" on the delete statement
What may be the reason for this?
Strangely it worked until I changed the bookmark "bmname" from being
a 1 char-bookmark to one that extends over a table and a pagebreak.
But the range to delete doesn't overlap with this bookmark's range,
so i wonder why there seems to be an interference.
Any hints much appreciated!
TIA & bye,
Alex
i want to copy a document and then remove some parts of it.
I do the copy with WordBasic.CopyFileA, since VBA.FileCopy
fails on opened docs.
After having copied the file, I open it using
Documents.Open in invisible manner.
Then I want to remove the first part of the document , from the
very beginning to one char before a certain bookmark
I use the following code
Set oRng = oNewDoc.Range(0, oNewDoc.Bookmark("bmname").Start - 1)
oRng.Delete
However i get error 5904, "Cannot edit range" on the delete statement
What may be the reason for this?
Strangely it worked until I changed the bookmark "bmname" from being
a 1 char-bookmark to one that extends over a table and a pagebreak.
But the range to delete doesn't overlap with this bookmark's range,
so i wonder why there seems to be an interference.
Any hints much appreciated!
TIA & bye,
Alex