Probleme avec GetPivotData
Bonjour, j'ai un problème avec l'utilisation de la fonction GetPivotData.
Il me renvoie l'erreur 1004 : "Application defined or object-defined error" au niveau de ma ligne Set ResultPivot=...
Ce code fonctionnait jusqu'à aujourdui...:/
Les paramètres de ma fonction ainsi que mes variables me semble bien énoncés, je ne vois pas ce qui ne va pas..
Voici mon code :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| Private Sub CommandButton1_Click()
Dim ws As Worksheet
Dim StartingHour As Integer
Dim EndingHour As Integer
Dim IntervalTime As String
Dim DayEvent As Integer
Dim ResultPivot As Range
Dim TimeSpent As Integer
Dim pvt As PivotTable
DayEvent = 1
StartingHour = 11
EndingHour = 14
IntervalTime = Format(StartingHour, "00") & "00/" & Format(EndingHour, "00") & "00"
Set ws = Worksheets("Pivot")
Set pvt = ws.PivotTables(1)
'ws.EnablePivotTable = True
Set ResultPivot = pvt.GetPivotData("Time spent on the release", "Frequency", DayEvent, "Time of release", IntervalTime)
TimeSpent = ResultPivot.Value
MsgBox TimeSpent
End Sub |
Merci d'avance pour votre aide et vos propositions...