Run-Time error 1004 Application defined or object defined error -

W

WirelessPete

I have an Excel 2007 application that connects to an OLAP database using a
pivot table. When the user changes a list box value in the workbook I refresh
the pivot table, which generates a new OLAP query. Works fine until the
spreadsheet sits for more than about 5 minutes, then I get a "Run-Time error
1004 Application defined or object defined error" on the first ActiveSheet
line.

Sub Update_CarrierDetailData(ByVal CurrentMarket As String, ByVal
CurrentSector As String)
Dim strCurrentSheet As String
Dim strCurrentCell As String

strCurrentSheet = ActiveSheet.Name
strCurrentCell = ActiveCell.Address
Sheets("CarrierDetail").Select


ActiveSheet.PivotTables("PivotTable2").PivotFields( _
"[Carrier].[Market].[Market]").ClearAllFilters
ActiveSheet.PivotTables("PivotTable2").PivotFields( _
"[Carrier].[Market].[Market]").CurrentPageName = _
"[Carrier].[Market].&[" & CurrentMarket & "]"

ActiveSheet.PivotTables("PivotTable2").PivotFields( _
"[Carrier].[Sector].[Sector]").CurrentPageName = _
"[Carrier].[Sector].&[" & CurrentSector & "]"

Sheets(strCurrentSheet).Select
Range(strCurrentCell).Select

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top