I have a macro, set to run when the workbook opens. (Full text below).
It works when run as a separate macro, after the workbook opens.
It works when opening the workbook from a local drive.
It does not work when opening the file in the DESKTOP APP, the file being sourced from sharepoint.
I get the error "Run time error 1004, unable to set the OutlineLevel property of the Range Class", sourced to the inner line of the For loop.
As the debug print hints, I can separately confirm the correct values are coming from the OutlineLevel column, and it's targeting the correct row.
The idea behind this is that I want my user to be able to keep the groups updated without needing to use the menus, so they edit the column and the workbook updates the groups when it opens. The values are being drawn from an Excel table on the Checklist tab.
Pre-emptive:
No, I don't want the users to run it as a separate macro, because I want the functionality kept simple for them and to have as few little tasks that need poking as possible.
No, it has to be kept active on Sharepoint as part of the company workflow.
No, as above, I am NOT running it in the browser where macros do not work, I am launching it directly in Excel, either from memory of saved files or from the Sharepoint site.
Private Sub Workbook_Open() Dim tbl_row As Range Dim outline_level As Range Dim chk_table As ListObject Set chk_table = Sheets("Checklist").ListObjects("ChecklistTable") Set outline_level = chk_table.ListColumns("Outline Level").Range For Each tbl_row In chk_table.DataBodyRange.Rows 'Debug.Print (Cells(tbl_row.Row, outline_level.Column)) 'Debug.Print (tbl_row.OutlineLevel) tbl_row.OutlineLevel = Cells(tbl_row.Row, outline_level.Column) Next tbl_row End Sub
I appreciate any help you can give with this admittedly odd behavior.
Ben