on 04-27-2015 11:11 AM
Hi all,
I need to execute a macro to allow grouping and ungrouping some rows and columns, in a protected EPM Report.
I have developed the following routines, but they continue not to be executed when I open the report.
Sub After_Workbook_Open()
Call grouping
End Sub
Sub grouping()
With Worksheets("IS HEPS BEPS")
.Unprotect "123"
.EnableOutlining = True
.Protect "123", contents:=True, userInterfaceOnly:=True
End With
End Sub
If I execute the macro directly in Excel it works as expected.
Can you help me identifying what may be missing?
Best regards
João Arvanas
This is an old question, but there's not a correct answer that properly addresses the correct steps.
Solution
Create a macro called after_workbook_Open and make sure it is in the a regular MODULE (i.e. Module1) NOT the workbook module, as one would do when using the standard excel method.
See below (note this particular approach is one I use on almost all templates to ensure that context member formulas are properly updated).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Joao,
Try the below code it should work...
Private Sub Workbook_Open()
Call grouping
End Sub
Sub grouping()
Sheets("IS HEPS BEPS").Unprotect Password:="123"
With Worksheets("IS HEPS BEPS")
.Protect Password:="123", UserInterfaceOnly:=True
.EnableOutlining = True
End With
End Sub
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Your code and and mine are working perfectIy, but getting executed whan opening EPM Addin Reports. Nevertheless I discovered what was the problem.
While trying the classical "WORKBOOK_OPEN" String I noticed that some of the actions were being overwritten by EPM Add-In, as the Layout was not yet loaded when the code was executed. The reason for that is, that EPM Add-In functionalities run after the "WORKBOOK_OPEN".
Insert a SUB in a Module that contains the string "AFTER_REFRESH" instead of "WORKBOOK_OPEN" and now it works.
Thanks for your support
João Arvanas
User | Count |
---|---|
13 | |
2 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.