Hi All,
Can anyone guide me that how can i add macro to shape in word document. I've below code but want to activate when someone will click on the shape to add image.
---Thanks in advance
Can anyone guide me that how can i add macro to shape in word document. I've below code but want to activate when someone will click on the shape to add image.
Code:
Private Sub CommandButton1_Click()
With Application.FileDialog(msoFileDialogFilePicker)
.AllowMultiSelect = False
.ButtonName = "Submit"
.Title = "Select an image file"
.Filters.Add "Image", "*.gif; *.jpg; *.jpeg", 1
If .Show = -1 Then
' file has been selected
' e.g. show path in textbox
Me.TextBox1.Text = .SelectedItems(1)
' e.g. display preview image in an image control
Me.Image1.PictureSizeMode = fmPictureSizeModeZoom
Me.Image1.Picture = LoadPicture(.SelectedItems(1))
Else
' user aborted the dialog
End If
End With
End Sub
---Thanks in advance
Last edited by a moderator: