1

I open a query from SAP BW... I make all the changes I need and I even check the box that says Refresh query every time you open the workbook. The problem is that when I reopen the workbook it's just like a regular Excel, because the SAPBEX.xla file is not loaded anymore.

Any ideas on how can I solve this?

I want the workbook updated with the latest data every time I open the workbook.

Thanks!

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
Andrei Ion
  • 1,777
  • 15
  • 34
  • 54
  • I am not familiar to SAP BW. Do you automatically query with Excel connections? What is SAPBEX.vba? – JMax Mar 03 '12 at 11:48
  • sorry, I made a mistake... it's sapbex.xla ... an ad-in for connecting and refreshing the queries – Andrei Ion Mar 03 '12 at 13:54
  • so the connection to SAP BW is operated by this add-in? Is it public? Apart from the fact that the add-in shouldn't get unloaded, I don't think I can help you here. – JMax Mar 03 '12 at 17:35
  • I solved the problem in the end... I had to set it up from Excel but now the add-in loads no matter what excel file I open... is there a way to make it load only when I open a specified file? – Andrei Ion Mar 03 '12 at 20:50

1 Answers1

2

You can use an application event (see Chip Pearson's website).

Put this code in the This Workbook module of your PERSONAL.XLSM (see here).

Private WithEvents App As Application

Private Sub Workbook_Open()
    Set App = Application
End Sub

And in a module:

Private Sub App_WorkbookOpen(ByVal Wb As Workbook)
    MsgBox "New Workbook: " & Wb.Name
    'or better check here if this is your workbook and activate the addin
End Sub
Community
  • 1
  • 1
JMax
  • 26,109
  • 12
  • 69
  • 88