#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Posts
    5
    Rep Power
    0

    VBScript + Access?


    MsgBox PivotTable5.ActiveData.Cells.DetailCells(0,0).Value

    Gives an error when I run?
  2. #2
  3. /(bb|[^b]{2})/

    Join Date
    Nov 2001
    Location
    Somewhere in the great unknown
    Posts
    5,163
    Rep Power
    792
    And what error might that be? And is it VBScript or VBA?
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Posts
    5
    Rep Power
    0
    VBScript.

    "Wrong number of arguments, or invalid property assignment:
    'PivotTable5.ActiveData.Cells'"
  6. #4
  7. /(bb|[^b]{2})/

    Join Date
    Nov 2001
    Location
    Somewhere in the great unknown
    Posts
    5,163
    Rep Power
    792
    I may be wrong, but doesn't the Cells require a row and column?

    more info...
    http://dbforums.com/arch/191/2002/6/399718
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Posts
    5
    Rep Power
    0
    That example is close, but I'm having some trouble adapting it to my situation. My table doesen't have any row or column fields, I just dragged all of my table fields into the 'DataAxis' area.

    (The thing that confuses/annoys me about this is how he has ActiveData.RowAxis as part of the expression, but when you go to type it in, RowAxis is missing from the autocomplete dropdown list.)
  10. #6
  11. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Posts
    5
    Rep Power
    0
    Apparently, this is the way to do it in VBA. Does anyone know the equivalent expression(s) for VBS?


    Dim CellValue
    Dim ActView As PivotView
    Dim fldSets As PivotFieldSets
    Dim Sel As PivotDetailRange
    Dim RowNum As Long
    Dim pvDetCell As PivotDetailCell
    Dim PvCell As PivotCell

    Set ActView = PvTable.ActiveView
    Set fldSets = ActView.FieldSets
    Set Sel = PvTable.selection
    Set pvDetCell = Sel.BottomRight
    RowNum = pvDetCell.Row

    With PvTable.ActiveData
    Set PvCell = .cells(.RowMembers(0), .ColumnMembers(0))
    End With
    CellValue = PvCell.DetailCells(RowNum, 4).value

IMN logo majestic logo threadwatch logo seochat tools logo