15.05.2021, 22:59
Versuche, eine Reihe von Schaltflächen zu haben, die 4-8 Bilder zum Vergleich einfügen und entfernen können.
Bin eigendlich ganz neu in VBA. Kann jemand überhaupt helfen?
Habe diesen Text im Internet gefischt....
Habe es fast fertig (meine ich
nur) , aber ich bekomme einen Fehler im Bereich zum Entfernen von Bildern.
Wohin es geht Next picPicture bekommt eine ungültige Next-Steuervariablenreferenz, ich bin mir nicht sicher warum.
Ich hoffe das ich mich verständlich gemacht habe was ich bewerkstelligen möchte, bin nicht mal für das sicher
.
Dankbar für jede Hilfe.
Niko
Bin eigendlich ganz neu in VBA. Kann jemand überhaupt helfen?
Habe diesen Text im Internet gefischt....
Habe es fast fertig (meine ich

Wohin es geht Next picPicture bekommt eine ungültige Next-Steuervariablenreferenz, ich bin mir nicht sicher warum.
PHP-Code:
Sub picture_insert ()
Dim picBild As Picture
Dim blnAvailable As Boolean
With worksheets ("sheet2")
.Unprotect Password: = "1234"
For Each picBild In .Pictures
If picBild.Name = "Picture Name" Then
'The picture already exists
blnVorhanden = True
Exit For
End If
Next picPicture
'only execute if picture does not yet exist
If blnVorhanden = False Then
With .Pictures.Insert ("" C: \ Temp \ Logo.jpg ")
.Name = "picture name"
.ShapeRange.LockAspectRatio = msoFalse
.Width = 100
.Height = 100
.Left = Worksheets ("Sheet2"). Range ("A10"). Left
.Top = Worksheets ("Sheet2"). Range ("G42"). Top
End With
End If
.Protect Password: = "1234", DrawingObjects: = True, Contents: = True, Scenarios: = True _
, AllowFormattingCells: = True
End With
End Sub
Sub Image_Remove ()
Dim picBild As Picture
With Worksheets ("Sheet2")
.Unprotect Password: = "1234"
For Each picBild In .Pictures
If picBild.Name = "Picture Name" Then
picBild.Delete
Exit For
End If
Next picPicture
.Protect Password: = "1234", DrawingObjects: = True, Contents: = True, Scenarios: = True _
, AllowFormattingCells: = True
End With
End Sub

Dankbar für jede Hilfe.
Niko
