none
Error 104 - unable to get the pictures property of the worksheet class RRS feed

  • Question

  • Hello, I'm triying to use a variable so that the layout will be the current week and next week only. But this error appears.

    "Error 1004 - Unable to get Insert Propeerty of the Pictures Class"

    Am I missing something in the code? (see below)

    Private Sub Report_Click()

     Cells.Select
        Sheets.Add
        
      
        ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
            "DP2 Forecast PC!R1C1:R1048576C63", Version:=xlPivotTableVersion14). _
            CreatePivotTable TableDestination:="Sheet1!R3C1", TableName:="PivotTable3" _
            , DefaultVersion:=xlPivotTableVersion14
        Sheets("Sheet1").Select
          With ActiveSheet.PivotTables("PivotTable3").PivotFields("ERP Code")
            .Orientation = xlRowField
            .Position = 1
        End With
        With ActiveSheet.PivotTables("PivotTable3").PivotFields("Desc")
            .Orientation = xlRowField
            .Position = 2
        End With
        Range("A4").Select
        Application.CutCopyMode = False
        ActiveSheet.PivotTables("PivotTable3").PivotFields("ERP Code").Subtotals = _
            Array(False, False, False, False, False, False, False, False, False, False, False, False)
        ActiveSheet.PivotTables("PivotTable3").PivotFields("ERP Code").LayoutForm = _
            xlTabular
            
            
        Range("Z4").Select
        ActiveCell.FormulaR1C1 = "=TODAY()"
        Range("Z5").Select
        ActiveCell.FormulaR1C1 = "=WEEKNUM(R[-1]C)"
        Range("Z6").Select
        ActiveCell.FormulaR1C1 = "=R[-1]C+1"
        
        
    Dim Thisweek As String

    Dim Futureweek As String

    Range("Z4").Select

    Thisweek = ActiveCell.Value

    Range("Z5").Select

    Futureweek = ActiveCell.Value

    Range("Z6").Select

     Range("A4").Select


             ActiveSheet.PivotTables("PivotTable3").AddDataField ActiveSheet.PivotTables( _
            "PivotTable3").PivotFields(Thisweek), "Count of Thisweek", xlCount
            
        ActiveSheet.PivotTables("PivotTable3").AddDataField ActiveSheet.PivotTables( _
            "PivotTable3").PivotFields(Futureweek), "Count of Futureweek", xlCount
            
            End sub


    Any help would be greatly appreciated! (in bold where I have the error)

    Friday, October 12, 2018 3:22 PM