Sorry you lost a lot of time with this. We will find a way to fix this issue, I promise
Okay, reviewing your video, I strongly suspect that the issue is that you have some foreign files in your Repo directory with names that do not match the convention expected by the macro: [trackingId]_[Version]_[FileName.SLDPRT]. I will add a check function to disregard such files so they don't cause this error. But just to make sure that this is the case, can you please do the following:
1. Edit the macro, and in Constants, change the line:
Code: Select all
Public Const DEBUG_ENABLED As Boolean = False
To
Code: Select all
Public Const DEBUG_ENABLED As Boolean = True
2. Run the macro again from the Core.main method, and try to create a new version or anything else that causes the "Subscript out of range" error. The macro editor should pop up with an error box. Click "debug".
3. Macro editor should pop into the function IsCurrentDocumentAlreadyInRepoWithDifferentFilename. Hower your mouse over the "fileName" variable, and it should show you the value of that variable, like in this screenshot:
If it does not match the [trackingId]_[Version]_[FileName.SLDPRT] convention... Then it means this is indeed the issue. Like I said, I can easily fix this, but I want to be 100% sure that this is what is causing the error for you
mgibeault wrote: ↑Wed Nov 06, 2024 3:32 pm
-Nothing happens if I just use "Tools->Macro->Run..." or use the button "Run Macro". The MainForm shows up when I assign the macro to a button. Is it because there's a field for the method (Core.main) that cannot be specified otherwise? I lost a lot of time trying to find why the macro would do nothing as I was testing with a "Run Macro" button.
Yeah, Tools->Run does not allow you to choose which method to run the macro from... Sometimes the macro "loses" the reference to which method is the default (entry) one, and I honestly don't know how to specify that. I can try to re-create the macro from scratch (copy over the code), maybe that will fix it. But for now, use a macro button, or run the macro from the macro editor by pressing F5 and then choosing the correct entry method (Core.main).
mgibeault wrote: ↑Wed Nov 06, 2024 3:32 pm
-When I "Step into" and then F8 repeatedly, I get in a loop here:
This is a loop that traverses through all of your files in the repo directory, you probably have quite a lot of them, that is why it appears to get stuck. You can add a breakpoint after the loop and press F5 to run the macro until that breakpoint, it will save you a lot of time.
mgibeault wrote: ↑Wed Nov 06, 2024 3:32 pm
-Where is defined the sentence "This will assign a new ID to the document xxxx.sldprt and reset version back to A.1. Versions associated with the old ID will remain in the repository. Are you sure to proceed?"
This is from AdditionalActionsForm:
For future reference, since you're making quite a few changes to this macro, you can find things easier if you do a global search with Ctrl+F and set the search scope to "Current project":
Let me know the results of that first test. And thanks!