Option Explicit
' \\ This sub inserts a Inline Picture to the selection
Sub InsertInlinePictureDialog()
Dim oDialog As Word.Dialog
' \\ Get a handle to the Insert picture dialog
Set oDialog = Dialogs(wdDialogInsertPicture)
' \\ Work with dialog
With oDialog
' \\ Display the dialog
.Display
' \\Insert InlineShape if the Name property (Filepath) <> ""
If .Name <> "" Then
ActiveDocument.InlineShapes.AddPicture FileName:=.Name, _
LinkToFile:=False, _
SaveWithDocument:=True, _
Range:=Selection.Range
End If
End With
' \\ Clean up
Set oDialog = Nothing
End Sub
' \\ This sub inserts a Shape (Flowting) Picture to the selection
Sub InsertFlowtingPictureDialog()
Dim oDialog As Word.Dialog
' \\ Get a handle to the Insert picture dialog
Set oDialog = Dialogs(wdDialogInsertPicture)
' \\ Work with dialog
With oDialog
' \\ Display the dialog
.Display
' \\Insert Shape Picture if the Name property (Filepath) <> ""
' \\ Set Left, Top, Width and Height properties to position the shape
If .Name <> "" Then
ActiveDocument.Shapes.AddPicture FileName:=.Name, _
LinkToFile:=False, _
SaveWithDocument:=True, _
Left:=120, _
Top:=20, _
Width:=150, _
Height:=150, _
Anchor:=Selection.Range
End If
End With
' \\ Clean up
Set oDialog = Nothing
End Sub
|