Bonjour LouReeD,
J'ai essayé donné ton idée à chatgpt pour qu'il me fasse une macro mais cela ne fonctionne pas. Le fichier que tu m'a joint ne fonctionne pas non plus.
J'ai eu une autre idée, il pourrait y avoir un timer pour lancer la macro toutes les 1 secondes par exemple mais je n'arrive pas à l'automatiser pour qu'il se lance automatiquement et en répétition.
Tu saurais le faire ?
Voici la macro que j'ai trouvé :
Dim TimerActive As Boolean
Private Sub Workbook_Open()
StartTimer
End Sub
Sub StartTimer()
If Not TimerActive Then
TimerActive = True
' Définir le premier appel de la macro img() après 1 seconde
Application.OnTime Now + TimeValue("00:00:01"), "img", , True
End If
End Sub
Sub StopTimer()
On Error Resume Next
Application.OnTime NextTime:=False
TimerActive = False
End Sub
Sub img()
Dim obj As Shape, c As Range
For Each obj In ActiveSheet.Shapes
If obj.Type = msoPicture Then
Set c = obj.TopLeftCell
' Centrer horizontalement
obj.Left = c.Left + (c.Width - obj.Width) / 2
' Centrer verticalement
obj.Top = c.Top + (c.Height - obj.Height) / 2
End If
Next obj
' Définir le prochain appel de la macro img() après 1 seconde
If TimerActive Then
Application.OnTime Now + TimeValue("00:00:01"), "img", , True
End If
End Sub