XLSLIM_RUN_AT_START

12 views
Skip to first unread message

Matthew Berry

unread,
May 20, 2024, 3:37:07 PMMay 20
to xlSlim Support
Hi Russel,

I've noticed that the XLSLIM_RUN_AT_START range only executes IF the sheet on which that named range is located is the activesheet when the workbook is opened.

If a different sheet is active when the workbook is closed, then the XLSLIM_RUN_AT_START range is not executed, and my python module formulas all show #NAME? errors, as I use XLSLIM_RUN_AT_START to register a module.

Could you possibly look into this for the next release?

Thanks so much!
M

xlSlim Dev

unread,
May 21, 2024, 3:28:53 AMMay 21
to Matthew Berry, xlSlim Support
Hi Matt,

I'll have a look at that. Thanks for letting me know.

Regards,
Russel

--
You received this message because you are subscribed to the Google Groups "xlSlim Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xlslim-suppor...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/xlslim-support/fa0d669b-059a-4276-8a90-1f9b7c383502n%40googlegroups.com.

xlSlim Dev

unread,
May 22, 2024, 6:06:11 AMMay 22
to Matthew Berry, xlSlim Support
Hi Matt,

I'm struggling to replicate this one, it works for me regardless of which sheet is active when the workbook is saved.

Are you creating the range with Workbook scope?
image.png
Could you also let me know what the logs say please? The C:\Users\<user>\AppData\Roaming\Microsoft\AddIns\xlSlim\xlslim-addin.log should have lines similar to this when a sheet is opened:
2024-05-22 10:58:39.6424 INFO xlSlim.AddInRegistration Calculated cell "$A$1" in named range XLSLIM_RUN_AT_START
2024-05-22 10:58:39.7503 INFO xlSlim.AddInRegistration Calculated cell "$A$2" in named range XLSLIM_RUN_AT_START
2024-05-22 10:58:39.8590 INFO xlSlim.AddInRegistration Calculated cell "$A$3" in named range XLSLIM_RUN_AT_START

Thanks,
Russel

xlSlim Dev

unread,
May 31, 2024, 4:25:29 AMMay 31
to Matthew Berry, xlSlim Support
Hi Matt,

The XLSLIM_RUN_AT_START named range can refer to multiple ranges. For example, in the screenshot below I set up three named ranges: module, python and register, These are then referenced in the XLSLIM_RUN_AT_START named range as =python,module,register. As the items within the XLSLIM_RUN_AT_START named range are dirtied and calculated in order this setup ensures the module and python named ranges are evaluated before being used in the register named range.

image.png

Interestingly, in my testing I found that even simply making the XLSLIM_RUN_AT_START named range =python was enough to trigger the the registration recalculation effectively, =python,module,register is a belts and braces approach that ends up running the registration three times, but that is harmless.

Regards,
Russel

On Thu, 30 May 2024 at 19:06, Matthew Berry <mattbe...@gmail.com> wrote:
Sorry for the slow response, been travelling.

Yes, the range has a Workbook scope.

But I just figured out the issue.  That cell named XLSLIM_RUN_AT_START contains this formula using two named references to cells containing the paths to my .py module file and my python environment.
=RegisterPyModule(module,python)

The xlslim-addin.log says that xlSlim calculated this XLSLIM_RUN_AT_START cell. However, the UDFs from the Python module are not recognized until I manually run the cell again.  So I'm not sure if it actually calculates this cell or not.

The workaround is to replace the "module" and "python" names in RegisterPyModule() with direct references to input cells (B4 and B5 in my case),. Then the formula in XLSLIM_RUN_AT_START does indeed execute properly and the imported functions are updated.

Also, powertip for anyone on Windows who needs to monitor the changes to a log file in real time this PowerShell command is useful:
get-content 'C:\Users\<username>\AppData\Roaming\Microsoft\AddIns\xlSlim\xlslim-addin.log' -Tail 0 -Wait
 



Matthew Berry

unread,
May 31, 2024, 4:43:13 AMMay 31
to xlSlim Dev, xlSlim Support
Sorry for the slow response, been travelling.

Yes, the range has a Workbook scope.

But I just figured out the issue.  That cell named XLSLIM_RUN_AT_START contains this formula using two named references to cells containing the paths to my .py module file and my python environment.
=RegisterPyModule(module,python)

The xlslim-addin.log says that xlSlim calculated this XLSLIM_RUN_AT_START cell. However, the UDFs from the Python module are not recognized until I manually run the cell again.  So I'm not sure if it actually calculates this cell or not.

The workaround is to replace the "module" and "python" names in RegisterPyModule() with direct references to input cells (B4 and B5 in my case),. Then the formula in XLSLIM_RUN_AT_START does indeed execute properly and the imported functions are updated.

Also, powertip for anyone on Windows who needs to monitor the changes to a log file in real time this PowerShell command is useful:
get-content 'C:\Users\<username>\AppData\Roaming\Microsoft\AddIns\xlSlim\xlslim-addin.log' -Tail 0 -Wait
 




Reply all
Reply to author
Forward
0 new messages