I am trying to automate updates to a pivot table. I used the macro recorder to get the syntax below:



ActiveSheet.PivotTables("InboundCalls").PivotFields ("[CallDates]").AddPageItem _
        "[CallDates].[All CallDates].[2008].[December].[5]", True


I then updated the code to include my date variables so that the report will always be updates with the current date:



 

'Get information about today's date
    strDate = Date
    strMonth = Format(strDate, "m")
    strMonthName = MonthName(strMonth)
    strDay = Format(strDate, "d")
    strYear = Format(strDate, "yyyy")
    strReportDate = strYear & strMonth & strDay

'Change the date on the first page
    Sheets("Summary").Select
    Cells(2, 1) = strDate
'Update the first 4 tabs (Set the Year Month and Day)
    Sheets("LecDaily").Select
    ActiveSheet.PivotTables("InboundCalls").PivotFields("[CallDates]").AddPageItem _
    "[CallDates].[All CallDates]." & [strYear] & "." & [strMonthName] & "." & [strDay] & ", True"


When the code executes I get an error that says:

Runtime error 1004

The item could not be found in the OLAP cube.



Any ideas on what might be causing this?