Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

zoom sur image par click souris avec VBA

4 réponses
Avatar
PJ
Bonjour à tous,

Voilà mon problème: je voudrais que lors d'un click sur une photo de mon
fichier celle-ci se grandit automatiquement.
Avez-vous une solution?

Merci d'avance et bonne journée.

PJ

4 réponses

Avatar
garnote
Salut PJ,

Une piste :
Cette macro agrandit ton image d'un facteur 2 quand tu cliques dessus.

Sub Image1_QuandClic()
With ActiveSheet.Shapes(Application.Caller)
L = .Left
T = .Top
W = .Width
H = .Height
.Left = L - W / 2
.Top = T - H / 2
.Width = 2 * W
.Height = 2 * H
End With
End Sub

Serge


"PJ" a écrit dans le message de news:
Bonjour à tous,

Voilà mon problème: je voudrais que lors d'un click sur une photo de mon
fichier celle-ci se grandit automatiquement.
Avez-vous une solution?

Merci d'avance et bonne journée.

PJ


Avatar
PJ
Merci serge,
Je vais tester ça et te dirai lundi.

PJ


Salut PJ,

Une piste :
Cette macro agrandit ton image d'un facteur 2 quand tu cliques dessus.

Sub Image1_QuandClic()
With ActiveSheet.Shapes(Application.Caller)
L = .Left
T = .Top
W = .Width
H = .Height
.Left = L - W / 2
.Top = T - H / 2
.Width = 2 * W
.Height = 2 * H
End With
End Sub

Serge


"PJ" a écrit dans le message de news:
Bonjour à tous,

Voilà mon problème: je voudrais que lors d'un click sur une photo de mon
fichier celle-ci se grandit automatiquement.
Avez-vous une solution?

Merci d'avance et bonne journée.

PJ







Avatar
garnote
Un peu mieux :

Sub Image1_QuandClic()
' x : Facteur d'agrandissement
' Exemples:
' x = 3 (trois fois plus grande)
' x = 1/2 (deux fois plus petite)
x = 2
With ActiveSheet.Shapes(Application.Caller)
L = .Left
T = .Top
W = .Width
H = .Height
.Left = L - (x - 1) * W / 2
.Top = T - (x - 1) * H / 2
.Width = x * W
.Height = x * H
End With
End Sub

Serge


"garnote" a écrit dans le message de news:
Salut PJ,

Une piste :
Cette macro agrandit ton image d'un facteur 2 quand tu cliques dessus.

Sub Image1_QuandClic()
With ActiveSheet.Shapes(Application.Caller)
L = .Left
T = .Top
W = .Width
H = .Height
.Left = L - W / 2
.Top = T - H / 2
.Width = 2 * W
.Height = 2 * H
End With
End Sub

Serge


"PJ" a écrit dans le message de news:
Bonjour à tous,

Voilà mon problème: je voudrais que lors d'un click sur une photo de mon
fichier celle-ci se grandit automatiquement.
Avez-vous une solution?

Merci d'avance et bonne journée.

PJ






Avatar
PJ
Bonjour Serge,

J'ai un peu de retard dans ma réponse mais je suis débordé.
J'ai pu tester et là, j'ai un problème d'incompatibilité de type.
Peut-être me faut-il charger une option ou autre...
Merci de m'éclairer.

Salutations
PJean


Un peu mieux :

Sub Image1_QuandClic()
' x : Facteur d'agrandissement
' Exemples:
' x = 3 (trois fois plus grande)
' x = 1/2 (deux fois plus petite)
x = 2
With ActiveSheet.Shapes(Application.Caller)
L = .Left
T = .Top
W = .Width
H = .Height
.Left = L - (x - 1) * W / 2
.Top = T - (x - 1) * H / 2
.Width = x * W
.Height = x * H
End With
End Sub

Serge


"garnote" a écrit dans le message de news:
Salut PJ,

Une piste :
Cette macro agrandit ton image d'un facteur 2 quand tu cliques dessus.

Sub Image1_QuandClic()
With ActiveSheet.Shapes(Application.Caller)
L = .Left
T = .Top
W = .Width
H = .Height
.Left = L - W / 2
.Top = T - H / 2
.Width = 2 * W
.Height = 2 * H
End With
End Sub

Serge


"PJ" a écrit dans le message de news:
Bonjour à tous,

Voilà mon problème: je voudrais que lors d'un click sur une photo de mon
fichier celle-ci se grandit automatiquement.
Avez-vous une solution?

Merci d'avance et bonne journée.

PJ