M
MetteHD
Hi!
On a userform I have a commandbutton which opens the wdDialogsInsertPicture.
The cursor is within a table with either one or two cells (the document can
have several pages, and the pages has a table with either one cell or two
cells), and the picture is inserted where the cursor is. So far so good, BUT
- I want the inserted picture to have certain formatproperties. In the code
below "ActiveDocument.Shapes(1).Select" I need to be able to select the
picture that what just inserted, but it selects the first picture in the
dokument instead. The newly inserted pictures isn't always the first or the
last picture that was inserted in the doucment, so I can't count to the last
inserted picture either.
Is there anyone who have some suggestions for how to deal with this? (And
save me from more sleepless nights )
Lot of thanks from Mette
-------------
If Selection.Information(wdWithInTable) Then
With Dialogs(wdDialogInsertPicture)
If .Show Then
ActiveDocument.Shapes(1).Select 'This is where the problem is.
With Selection.ShapeRange
.LockAspectRatio = msoTrue
.Width = 150
.Left = wdShapeRight
.WrapFormat.Type = wdWrapSquare
.WrapFormat.Side = wdWrapLeft
End With
Selection.MoveLeft Unit:=wdCharacter, Count:=1
End If
End With
End If
--
On a userform I have a commandbutton which opens the wdDialogsInsertPicture.
The cursor is within a table with either one or two cells (the document can
have several pages, and the pages has a table with either one cell or two
cells), and the picture is inserted where the cursor is. So far so good, BUT
- I want the inserted picture to have certain formatproperties. In the code
below "ActiveDocument.Shapes(1).Select" I need to be able to select the
picture that what just inserted, but it selects the first picture in the
dokument instead. The newly inserted pictures isn't always the first or the
last picture that was inserted in the doucment, so I can't count to the last
inserted picture either.
Is there anyone who have some suggestions for how to deal with this? (And
save me from more sleepless nights )
Lot of thanks from Mette
-------------
If Selection.Information(wdWithInTable) Then
With Dialogs(wdDialogInsertPicture)
If .Show Then
ActiveDocument.Shapes(1).Select 'This is where the problem is.
With Selection.ShapeRange
.LockAspectRatio = msoTrue
.Width = 150
.Left = wdShapeRight
.WrapFormat.Type = wdWrapSquare
.WrapFormat.Side = wdWrapLeft
End With
Selection.MoveLeft Unit:=wdCharacter, Count:=1
End If
End With
End If
--