OK, so I did seem to discover a way to access the code within one macro, from within another macro, but have not had time to fully explore its various properties and methods yet, and VBA side documentation seems to be difficult to come by for the things I'm finding.
As you may, or may not know, the primary starting point of accessing Inventor's VBA stuff though using Inventor's API, is through the ThisApplication.VBAProjects property. That property returns an InventorVBAProjects (a type that is still native to Inventor). But that object (and many if its child objects that are native to Inventor) also offer a property for accessing the non-native object that it represents, as a generic Object, not as that other Type. However, if going at this entirely from VBA, there is a reference you can turn on, which will enable recognition of the proper object Types, and allow you to dig deeper into those non-native objects, with some Intellisense help. That reference is "Microsoft Visual Basic for Applications Extensibility 5.3". With the code screen open for your new macro that you will be using to access your old macros, to go the Tools tab, then References. Then scroll to that reference and make sure the check box next to it is checked, then click OK, to get back to your code screen.
Below is a starter VBA macro code that I was exploring with. You can play around with this some more if you want. I was able to extract a couple lines of code from a little test macro within another open Inventor document's VBA project, and show it in a MsgBox, just as a test, and it worked OK. I also see other methods in there that sound interesting. It may just take some good old trial & error testing and further exploration.
Sub EditOtherVBAMacro()
Dim sModuleName As String
sModuleName = "Module1"
Dim sMacroName As String
sMacroName = "MyMacro1"
Dim oProjects As InventorVBAProjects
Set oProjects = ThisApplication.VBAProjects
Dim oProject As InventorVBAProject
For Each oProject In oProjects
If oProject.ProjectType = kDocumentVBAProject Then
'must have reference turned on for "Microsoft Visual Basic for Applications Extensibility 5.3"
Dim oVBProj As VBProject '(VBA only Type, recognized by reference)
Set oVBProj = oProject.VBProject
'Components can be standard Module, Class Module, or UserForm
Dim oVBComps As VBComponents
Set oVBComps = oVBProj.VBComponents
Dim oVBComp As VBComponent
For Each oVBComp In oVBComps
If oVBComp.Type = vbext_ct_StdModule And oVBComp.Name = sModuleName Then
Dim oCodeModule As CodeModule
Set oCodeModule = oVBComp.CodeModule
'there are multiple methods & properties available under this object type
'we may be able to use these to edit the code as needed
'Dim o2LinesOfCodeFromOtherMacro As String
'o2LinesOfCodeFromOtherMacro = oCodeModule.Lines(2, 2)
'Call MsgBox(o2LinesOfCodeFromOtherMacro, , "")
'Call oCodeModule.DeleteLines(1, oCodeModule.CountOfLines)
'Call oCodeModule.AddFromFile(sFileName)
'oCodeModule.AddFromString(sMyReplacementCodeString)
End If
Next 'oVBComp
End If
Next 'oProject
End Sub
I did manage to find some relative documentation for some of these non-native objects, but from the .Net side of the equation, not the VBA side.
https://learn.microsoft.com/en-us/dotnet/api/microsoft.vbe.interop?view=office-pia
This link below also seemed informational, so you may want to take a look at that too.
https://www.engram9.info/excel-2002-vba-xml-asp/vbproject-object-vbcomponent-object-and-reference-ob...
Once you have that reference turned on, you can select some of the non-native object properties, then right-click, and choose Define. That usually shows the Object Browser (if it was not already visible), and displays information about that object/property. However, at the top left corner of the Object Browser, it is best if you use the drop-down list, and set that to "VBIDE" first. Then the Classes & Members lists below will be filled with stuff defined under that resource. You can see all those object types, can click on them, and see the members of each type that way. Wish I could be of more help, but I've got to get some other stuff done right now.
Wesley Crihfield

(Not an Autodesk Employee)