Showing results for 
Search instead for 
Did you mean: 

How to set a timeout for Analysis for MS Office Sessions



Is there a way to define a timout for BIP sessions created via Analysis for MS Office?

Many thanks in advance!

Best Regards,


View Entire Topic

You can use the below macro within any worksheet module. I admit it's tedious to deploy these on each workbook, but it works until this feature is included. You can adjust the parameters in the constants at the top. You could also change to base it off of different sheet events such as change event.

'VBA timeout code for SAP Analysis for Office 
'(hopefully this won't be needed in future versions)
'Insert this code in the one (or more) WORKSHEET modules in a workbook (not a regular module like "Module1")

'Need this variable at the module level to keep track of last click.
    Private timeLIMT As Date

'Set this to False to disable a useful alert message
    Const showWarningOfSignoff As Boolean = True

'Set Timeout limt for inactivity in seconds
    Const secondsFOrTIme As Long = 3600

'You should leave these exact words to alert your users, especially if they are Americans. They will thank you.
    Const messageToDisplay As String = "Boom!! You've been booted! This is a feature your administrator asked for!"

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'Built by Steven Rider with    

    If timeLIMT = 0 Then
        'first instance
        timeLIMT = TimeSerial(0, 0, secondsFOrTIme) + Now
    ElseIf Now >= TimeSerial(0, 0, secondsFOrTIme) + timeLIMT Then 'too long!
        Dim gone As Long
        On Error Resume Next 'required to avoid error if already logged off
        gone = Application.Run("SAPLogOff", True)
        On Error GoTo 0 'turn error checking back on.
        'optional message after a successful logoff
        If gone = 1 And showWarningOfSignoff Then MsgBox messageToDisplay
        'reset the time limit
        timeLIMT = TimeSerial(0, 0, secondsFOrTIme) + Now
    End If

End Sub