views:

430

answers:

0

Hi, I'm trying to write a macro where I press a button and a dialog window appear which lets me choose an image I want to insert to the document. I've managed to do this by this simple code:

Private Sub btnInsertPicture_Click()
Dialogs(wdDialogInsertPicture).Show
    For Each ishape In ActiveDocument.InlineShapes
        With ishape
            ImageWidth = .Width
            ImageHeight = .Height
            NewHeight = 656
            NewWidth = 413
            .Height = NewHeight
            .Width = NewWidth
        End With
    Next
End Sub

However, the picture gets inserted as an inLine shape, meaning I cannot format it to wrap text around etc. Now, I know theres something called oShape which lets me do alot more with the image. But the Dialogs(wdDialogInsertPicture).Show inserts an inline shape by default.

I did find this code which allows me to insert an oShape image. But the code seems to require me to specify the filename directly. The whole point of the macro is that the user is supposed to be able to choose the image from the dialog.

How can I either insert the oShape by default or convert the iShape to oShape?