Quantcast
Channel: SCN : Discussion List - SAP BusinessObjects Analysis, edition for Microsoft Office
Viewing all articles
Browse latest Browse all 1521

problem to run own vba code after refresh

$
0
0

Hi @ all,

 

i recently switched from BEx Analyzer to SAP BO Analysis 1.4.

I have quite a few workbooks with own vba code. In BEx Analyzer I used the SAPBEXonRefresh method to run the code after refreshing of the data.

 

But now I don't know how to get it started.

I already browsed through this forum and tried to apply some findings but it still wont work - hope for help!

 

Here is the situation

 

I have this code in the "This workbook" section:

Public Sub Workbook_SAP_Initialize()

Call Application.Run("SAPExecuteCommand", "RegisterCallback", "AfterRedisplay", "Callback_AfterRedisplay")

End Sub

 

Then I have a module called "Modul1" with the following code

 

Public Sub Callback_AfterRedisplay()

 

    Dim intStartRow As Integer

    Dim intStartCol As Integer

    Dim intRow As Integer

    Dim intCol As Integer

    Dim strError As String

  

    strError = "other error"

 

    intStartRow = 2

    intRow = intStartRow

    intStartCol = 9

    intCol = intStartCol

  

    Application.Worksheets("ae").Activate

    Application.Worksheets("ae").EnableCalculation = False

    Application.Worksheets("ae").Cells(intStartRow, intStartCol).Select

  

    Worksheets("ae").Range("I3:T65536").Delete

 

 

    If Not Application.Worksheets("ae").Cells(intStartRow, 1) = "" Then

  

        Do While Not (Application.Worksheets("ae").Cells(intRow + 1, 1)) = ""

        'Debug.Print Application.Worksheets("summary").Cells(intRow + 1, 1)

          

            intRow = intRow + 1

      

      

        Loop

        intCol = 9

      

        Application.Worksheets("ae").Range((Application.Worksheets("ae").Cells(intStartRow, intCol)), Application.Worksheets("ae").Cells(intStartRow, intCol + 11)).Copy

        Application.Worksheets("ae").Range((Application.Worksheets("ae").Cells(intStartRow + 1, intCol)), Application.Worksheets("ae").Cells(intRow, intCol + 11)).Select

        Application.Worksheets("ae").Paste

        Application.Worksheets("ae").EnableCalculation = True

        Application.Worksheets("ae").Calculate

 

        strError = "ae"

      

        Application.Worksheets("pivot").PivotTables("PivotTable1").RefreshTable

        Application.Worksheets("pivot").Activate

      

      

    End If

    End If

 

End Sub

 

Anyone with an idea?

Thanks in advance


Viewing all articles
Browse latest Browse all 1521

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>