How do get a macro to be used only on a specific spreadsheet

Hello

I am sure there must be a way of isolating macros a specific spreadsheet. I’ve researched the question and found answers from 2013 etc. but none seem to work on version 6.4.7.2. Can anyone help me out with this please.

Bob

Whatever makes YOUR spreadsheet specific can be evaluated.

Based on which fact?

What have you tested?
Wich error occurs?
.
The basic concepts have not changed much over the years.
At first: Store the macro in the Calc-File, not in your library. Then it is only available, when the file is open.
Further steps may be password-protections for library or table.
Last step: Put the file in a veracrypt-container, so it is only available, when the container is opened…
.
For maximum security however: delete after using…
.
But the first question is: What is your plan? Protecting your valuable source-code, so nobody can use it elswhere? Preventing your AI from escaping and rule the world. The approaches for theese problems are quite different…

Hi Wanderer

Thank you for your reply. I see I needed to add more details to my post. This is not a security issue. Let me start over. When I open a spreadsheet in a specific file I have a macro that I use. I now have a second file with a different macro but the problem is my first macro opens up on the second file. So I need a way to keep a specific macro in each separate file and wow does this get done. If you happen to have a step by step I would be very grateful. I think I can’t find anything due to incorrect wording.
Bob

Beyond the “keep the macros within their respective spreadsheets” answer, which I would have given too, apply the following:

  1. Make sure that both macros haven’t got subprograms with the same names/parameters (aka signature).

  2. If 1. is too complicated, always make sure to fully specify the macros to call.Ex: MyLibrary.MyModule.MySub(blah) or
    SomeVar = MyLibrary.MyModule.MyFunc(blah)

  3. Check the “global” constants and variables in these macros modules, if any, are not declared as Global but Public. This should restrain their visibility to the owning library (thus, document)

These precautions should take care of crossed calls between files.

Hi jfn

Thank you for your reply. I don’t think I would have found this suggestion anywhere. I will work on this and get back to you. Have a great weekend.
Bob

Hi
I must apologize for my delay in getting back to you. Your suggestion is the best I’ve ever found on the net.
Thank you very mush.
Bob