|
UserFormに拘るなら、他の人のレスを待って下さい。
先に書いたダイアログシート方式なら、アクティブシートに4つの画像が
挿入されているとして・・
Sub Ap_Obj_Dialog()
Dim Lp1 As Single, Tp1 As Single
Dim Lp2 As Single, Tp2 As Single
Dim Wp As Single, Hp As Single
Dim i As Integer
With ActiveSheet
If .Pictures.Count < 4 Then Exit Sub
End With
With DialogSheets(1)
If .DrawingObjects.Count > 0 Then
.DrawingObjects.Delete
End If
With .DialogFrame
Lp1 = .Left + 5: Tp1 = .Top + 15
Lp2 = .Left + (.Width / 2 + 5)
Tp2 = .Top + (.Height - 25) / 2 + 20
Wp = .Width / 2 - 20: Hp = (.Height - 25) / 2
End With
For i = 1 To 4
ActiveSheet.Pictures(i).Copy
.Paste
Application.CutCopyMode = False
Next i
With .Pictures
With .Item(1)
.Left = Lp1: .Top = Tp1
.Width = Wp: .Height = Hp
End With
With .Item(2)
.Left = Lp2: .Top = Tp1
.Width = Wp: .Height = Hp
End With
With .Item(3)
.Left = Lp1: .Top = Tp2
.Width = Wp: .Height = Hp
End With
With .Item(4)
.Left = Lp2: .Top = Tp2
.Width = Wp: .Height = Hp
End With
End With
.Show
End With
End Sub
というコードで出来ます。
こちらでテストした環境で、うまく配置できてました。
|
|