19.05.2021, 07:26
(Dieser Beitrag wurde zuletzt bearbeitet: 19.05.2021, 09:05 von schauan.
Bearbeitungsgrund: Codetags
)
Hallo Zusammen,
über den Dialog "BildQuelle = Application.GetOpenFilename(Title:="Bitte Bilder auswählen:", FileFilter:="Bilder,*.jpg", MultiSelect:=True)"
lade ich mir 6 Bilder in den aktiven Sheet (Bilder). Diese werden entsprechend Vorgabe positioniert
Meine Frage: wie kann ich die Bilder vorher im Array "arrShape()" sortieren?
IST
Bildnummer_sek_1-.jpg
Bildnummer_sek_1+.jpg
Bildnummer_sek_2-.jpg
Bildnummer_sek_2+.jpg
Bildnummer_sek_3-.jpg
Bildnummer_sek_3+.jpg
SOLL
Bildnummer_sek_1+.jpg
Bildnummer_sek_1-.jpg
Bildnummer_sek_2+.jpg
Bildnummer_sek_2-.jpg
Bildnummer_sek_3+.jpg
Bildnummer_sek_3-.jpg
Grüße, Andreas
über den Dialog "BildQuelle = Application.GetOpenFilename(Title:="Bitte Bilder auswählen:", FileFilter:="Bilder,*.jpg", MultiSelect:=True)"
lade ich mir 6 Bilder in den aktiven Sheet (Bilder). Diese werden entsprechend Vorgabe positioniert
Code:
...
Dim AnZahlPic As String
AnZahlPic = "6"
ReDim arrShape(1 To limit)
For Index = 1 To limit
Set arrShape(Index) = ActiveSheet.Shapes.AddPicture(BildQuelle(Index), False, True, abstand, hoehe, BildBreite, BildHoehe)
Next Index
With Worksheets("Bilder")
If AnZahlPic = "6" Then
For Index = 1 To limit
Select Case Index
Case 1:
arrShape(1).Top = Sec1Rahm1.Top + abstandTop
arrShape(1).Left = Sec1Rahm1.Left + abstandLinks
Case 2:
arrShape(2).Top = Sec1Rahm3.Top + abstandTop
arrShape(2).Left = Sec1Rahm3.Left + abstandLinks
Case 3:
arrShape(3).Top = Sec2Rahm1.Top + abstandTop
arrShape(3).Left = Sec2Rahm1.Left + abstandLinks
Case 4:
arrShape(4).Top = Sec2Rahm3.Top + abstandTop
arrShape(4).Left = Sec2Rahm3.Left + abstandLinks
Case 5:
arrShape(5).Top = Sec3Rahm1.Top + abstandTop
arrShape(5).Left = Sec3Rahm1.Left + abstandLinks
Case 6:
arrShape(6).Top = Sec3Rahm3.Top + abstandTop
arrShape(6).Left = Sec3Rahm3.Left + abstandLinks
End Select
Next
End If
End With
...
IST
Bildnummer_sek_1-.jpg
Bildnummer_sek_1+.jpg
Bildnummer_sek_2-.jpg
Bildnummer_sek_2+.jpg
Bildnummer_sek_3-.jpg
Bildnummer_sek_3+.jpg
SOLL
Bildnummer_sek_1+.jpg
Bildnummer_sek_1-.jpg
Bildnummer_sek_2+.jpg
Bildnummer_sek_2-.jpg
Bildnummer_sek_3+.jpg
Bildnummer_sek_3-.jpg
Grüße, Andreas