Option
Explicit
Private
Sub
CommandButton4_Click()
Call
Insert_Picture(CommandButton4)
End
Sub
Private
Sub
CommandButton5_Click()
Call
Insert_Picture(CommandButton5)
End
Sub
Private
Sub
Insert_Picture(
ByRef
probjCommandButton
As
MSForms.CommandButton)
Dim
eingabe
As
String
Dim
lngIndex
As
Long
lngIndex = Mid$(
String
:=probjCommandButton.Name, Start:=Len(TypeName(probjCommandButton)) + 1)
Application.Dialogs(xlDialogInsertPicture).Show
With
Selection.ShapeRange
.LockAspectRatio =
False
.Top = Range(
"Picture"
& lngIndex).Top
.Left = Range(
"Picture"
& lngIndex).Left
.Height = Range(
"Picture"
& lngIndex).Height
.Width = Range(
"Picture"
& lngIndex).Width
End
With
eingabe = InputBox(
"Please insert a picture caption"
)
Range(
"Caption"
& lngIndex).Value =
"Fig. "
& lngIndex &
": "
& eingabe
End
Sub