View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Austin Austin is offline
external usenet poster
 
Posts: 10
Default Method €˜CurrentPage of object €˜Pivot €˜Failed €œ

Hello,

I am migrating my excel macros from 2003 to 2007. The excel macro was
working fine with 2003. But now when I run a particular report, in 2007
sometimes I am getting the error like €œRun time Error 2157417848(80010108)
Method €˜CurrentPage of object €˜Pivot €˜Failed €œ
I dont know what the reason for this error is. Sometimes only am getting
this error and sometimes the macro is working very fine.


Private Sub RTS_Change()
Dim tempStr As String
tempStr = RTS.text
ColumnRTS = "J"

Application.ScreenUpdating = False

If (tempStr < "All") Then
Module1.PasteValuesInPricelistColumn tempStr, ColumnRTS
Sheets("History Report").Select
ActiveSheet.Unprotect
ActiveSheet.PivotTables("HistoryPivot").PivotField s("R T S").CurrentPage =
tempStr
Module1.pivotTableUpdate
Else
Sheets("History Report").Select
ActiveSheet.Unprotect
Module1.pivotTableUpdate
End If
End Sub


In the above code, in "RTS.text" RST is the name of the combobox Im using in
the report. I have removed the multiple use of "ActiveSheet." and gave the
sheet name directly itself, then also the same error. I have ran the report
for the same criteria, then again am getting error sometimes and sometimes
not. tempStr will always contain the value as "(All)". Please provide me help
on this issue, as am hangup with this for the past 1 month.
Thanks in advance.
-Austin