Skip to Content

Not refreshing automatically after Selection


whenever the selection of profit center, the sheet has to refresh automatically. i have written VB macros and enable refresh options. but still, it is not refreshing after selection.

attached scrrenshot.

ss5.png (34.6 kB)
ss6.png (21.0 kB)
Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    Posted on Oct 20, 2019 at 03:04 PM

    Easy! First I don't see FPMXLClient reference:

    Second: simple working code:

    Option Explicit
    Dim epm As New FPMXLClient.EPMAddInAutomation
    Public Function AFTER_CONTEXTCHANGE() As Boolean
        Dim wshCurrent As Worksheet
        Dim objCurrent As Object
        Set wshCurrent = ThisWorkbook.ActiveSheet
        If wshCurrent.Name = "Sheet1" Then
            Set objCurrent = Application.Selection 'Save current selection
            wshCurrent.Range(epm.GetDataTopLeftCell(wshCurrent, "000")).Select
            objCurrent.Select 'Restore current selection
        End If
    End Function

    fpm.png (37.5 kB)
    Add a comment
    10|10000 characters needed characters exceeded

    • If you prefer to use universal code working with both EPM Add-In and AO with late binding and without referencing FPMXLClient, then:

      Instead of

      Dim epm As New FPMXLClient.EPMAddInAutomation

      Use inside your procedure:

          Dim objAddIn As COMAddIn
          Dim epm As Object
          Dim AOComAdd As Object
          Dim blnEPMInstalled As Boolean
          'Universal code to get FPMXLClient for standalone EPM or AO
          For Each objAddIn In Application.COMAddIns
              If objAddIn.progID = "FPMXLClient.Connect" Then
                  Set epm = objAddIn.Object
                  blnEPMInstalled = True
                  Exit For
              ElseIf objAddIn.progID = "SapExcelAddIn" Then
                  Set AOComAdd = objAddIn.Object
                  Set epm = AOComAdd.GetPlugin("")
                  blnEPMInstalled = True
                  Exit For
              End If
          Next objAddIn
          If Not blnEPMInstalled Then
              MsgBox "Error! EPM not installed!"
              Exit Sub
          End If
          epm.RefreshActiveReport ' or any other

      Sample in my blog:

  • Posted on Oct 21, 2019 at 05:11 AM

    Thank you issue resolved...

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.