Erreur d'exécution '1004

Bonsoir,

Depuis que je suis passé sur office 2021, j'ai une erreur sur cette ligne (Erreur d'exécution '1004') :

    poinTtoPixel = (.PointsToScreenPixelsY(Cells.Height) - ActiveWindow.ActivePane.PointsToScreenPixelsY(0)) / Cells.Height

Voici le code intégral, qui permet d'ouvrir un usf dans un emplacement précis. (Cellule)

Sub USFPositionMotif(Target, USF)
  Dim X&, Y&, poinTtoPixel#
  With ActiveWindow.ActivePane
    poinTtoPixel = (.PointsToScreenPixelsY(Cells.Height) - ActiveWindow.ActivePane.PointsToScreenPixelsY(0)) / Cells.Height
    X = .PointsToScreenPixelsX((Target.Offset(0, 1).Left) - 150) / poinTtoPixel
    Y = .PointsToScreenPixelsY(Target.Top) / poinTtoPixel - 118
  End With
  With USF
    .StartUpPosition = 0
    .Show 0
    .Top = Y: .Left = X
  End With
End Sub

Que pensez-vous ?

bonjou Ronibo,

ce sera 1 des 3 variables, donc vous avez une erreur sur quelle ligne avec cette macro

Sub test()
     Dim X&, Y&, poinTtoPixel#
     With ActiveWindow.ActivePane

Debug.Print .PointsToScreenPixelsY(Cells.Height)
Debug.Print ActiveWindow.ActivePane.PointsToScreenPixelsY(0)
Debug.Print Cells.Height

          poinTtoPixel = (.PointsToScreenPixelsY(Cells.Height) - ActiveWindow.ActivePane.PointsToScreenPixelsY(0)) / Cells.Height
     End With

End Sub
Rechercher des sujets similaires à "erreur execution 1004"