Hello friends,
I am trying to export all Shapes and InlineShapes in a document into a second document, delete them in the first and replace them there with identifiable Tags.
So where e.g. a text frame used to be in the original doc, I would only have this left:
[ignore]<text frame 1>
whereas the second doc would contain this:
<text frame 1>contents of the text field</text frame 1>[/ignore]
The export functions well, all shapes and inline shapes get exported, and the tags, too, are created fine.
Problem: they are not created where the shape used to be!
Instead, I end up with a sequence of tags of my former shapes on top of the document.
![[sadeyes] [sadeyes] [sadeyes]](/data/assets/smilies/sadeyes.gif)
Neither the .select nor .activate helped me.
My last attempt was adding a bookmark before deletion, but alas: the bookmark, too, is created at the start of the document...
![[ponder] [ponder] [ponder]](/data/assets/smilies/ponder.gif)
Here's the crucial part of the code:
Any help greatly appreciated!
Thanks,
Andy
[blue]Speak out against Human Rights violations in China/Tibet
[/blue]
I am trying to export all Shapes and InlineShapes in a document into a second document, delete them in the first and replace them there with identifiable Tags.
So where e.g. a text frame used to be in the original doc, I would only have this left:
[ignore]<text frame 1>
whereas the second doc would contain this:
<text frame 1>contents of the text field</text frame 1>[/ignore]
The export functions well, all shapes and inline shapes get exported, and the tags, too, are created fine.
Problem: they are not created where the shape used to be!
Instead, I end up with a sequence of tags of my former shapes on top of the document.
![[sadeyes] [sadeyes] [sadeyes]](/data/assets/smilies/sadeyes.gif)
Neither the .select nor .activate helped me.
My last attempt was adding a bookmark before deletion, but alas: the bookmark, too, is created at the start of the document...
![[ponder] [ponder] [ponder]](/data/assets/smilies/ponder.gif)
Here's the crucial part of the code:
Code:
For Each shp In original.Shapes
shp.Select
If shp.TextFrame.HasText Then
shp.TextFrame.TextRange.Copy
Else
Selection.Copy
End If
theTag = "< " & shp.Name & ">"
endTag = "</" & shp.Name & ">"
extract.Activate
Selection.TypeText theTag
Selection.Paste
Selection.TypeText endTag & vbCrLf
original.Activate
shp.Select
Selection.Bookmarks.Add ("temp")
shp.Delete
Selection.GoTo wdGoToBookmark, "temp"
Selection.TypeText theTag & vbCrLf
Selection.Bookmarks("temp").Delete
Next shp
Any help greatly appreciated!
Thanks,
Andy
[blue]Speak out against Human Rights violations in China/Tibet
[/blue]