ActiveSheet.PivotTableWizard _
SourceType:=xlExternal, _
SourceData:=Array(strSQL, strSQL1), _
tableDestination:=Worksheets(strSheet).Range("a2"), _
tableName:=strSheet, _
RowGrand:=True, _
ColumnGrand:=True, _
SaveData:=True, _
HasAutoFormat:=True, _
BackgroundQuery:=False, _
Connection:=Array(g_strConn)
its giving me an error
"Run-time error 1004 -- Pivot table wizard method of worksheet class failed."
it also calls verifyPivot name as strPivot = VerifyPivotName(strSheet).
strsheet is coming up with value "sheet1".
but the function verifypivotname doesnt show it.
Public Function VerifyPivotName(strSheetName As String) As String
Dim nCount As Integer
Dim strPivot As String
nCount = ActiveSheet.PivotTables.Count
ActiveSheet.Range("a2").Select
If nCount > 0 Then
strPivot = Worksheets(strSheetName).PivotTables(1).Name
Else
VerifyPivotName = "-99990000"
Err.Raise 2
Exit Function
End If
cud this be a possibility tht i hav to name the pivot table first. if yes how?
please help .
Bookmarks