H
Hans Troost
L.S.
Due to demo of an application I have to replace about 10.000
inlineshapes (special type, ISIS/Draw)
in 4000 Word doc's by inlineshapes randomly selected from a an example
Database with these drawings.
Problem: it is easy to replaCe the Inlineshape (always the first and
only one withing a Bookmark)
but I seem to be unable to select it again after replacing after
replacing. And that is what I need
to restore the bookmark.
Can someone help me out?
I'm using WordXP (also called Word 2002)
Here's my code:
Sub ReplaceSketchInDoc(ActiveDoc As Document, BM As String, SkType As
enumSketch_Type)
Dim iShp As InlineShape
Dim rgPlace As Range
Dim ScaleFactor As Single
Dim OldWidth As Long
Dim NewWidth As Long
Dim OldHeight As Long
Dim NewHeight As Long
On Error GoTo Error_ReplaceSketchInDoc
Set rgPlace = ActiveDoc.Bookmarks(BM).Range
' insert the Sketch file from the clipboard after creation with
CreateSketchFile)
Call CreateSketchFile(SkType)
With rgPlace.InlineShapes(1)
.Select
.Range.PasteAndFormat (wdFormatOriginalFormatting)
End With
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! till here: everything is going fine, but
! the next statement goes wrong
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Set ihsp = Selection ! this does not work, there seems to be no
selection!!!
' make sure bookmark covers sketch
ActiveDoc.Bookmarks.Add Name:=BM, Range:=iShp.Range
Exit_ReplaceSketchInDoc:
Exit Sub
Error_ReplaceSketchInDoc:
Call Err.Raise(Err.Number, "ReplaceSketchInDoc", Err.Description)
Resume Exit_ReplaceSketchInDoc
End Sub
Thanks in advance,
Hans Troost
Due to demo of an application I have to replace about 10.000
inlineshapes (special type, ISIS/Draw)
in 4000 Word doc's by inlineshapes randomly selected from a an example
Database with these drawings.
Problem: it is easy to replaCe the Inlineshape (always the first and
only one withing a Bookmark)
but I seem to be unable to select it again after replacing after
replacing. And that is what I need
to restore the bookmark.
Can someone help me out?
I'm using WordXP (also called Word 2002)
Here's my code:
Sub ReplaceSketchInDoc(ActiveDoc As Document, BM As String, SkType As
enumSketch_Type)
Dim iShp As InlineShape
Dim rgPlace As Range
Dim ScaleFactor As Single
Dim OldWidth As Long
Dim NewWidth As Long
Dim OldHeight As Long
Dim NewHeight As Long
On Error GoTo Error_ReplaceSketchInDoc
Set rgPlace = ActiveDoc.Bookmarks(BM).Range
' insert the Sketch file from the clipboard after creation with
CreateSketchFile)
Call CreateSketchFile(SkType)
With rgPlace.InlineShapes(1)
.Select
.Range.PasteAndFormat (wdFormatOriginalFormatting)
End With
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! till here: everything is going fine, but
! the next statement goes wrong
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Set ihsp = Selection ! this does not work, there seems to be no
selection!!!
' make sure bookmark covers sketch
ActiveDoc.Bookmarks.Add Name:=BM, Range:=iShp.Range
Exit_ReplaceSketchInDoc:
Exit Sub
Error_ReplaceSketchInDoc:
Call Err.Raise(Err.Number, "ReplaceSketchInDoc", Err.Description)
Resume Exit_ReplaceSketchInDoc
End Sub
Thanks in advance,
Hans Troost