You may already know this, but when you insert a macro feature using IFeatureManager::InsertMacroFeature3, the last argument lets you specify whether to embed the macro feature if the macro is written in VBA. If you choose to embed, there is no way to switch to a non-embedded macro feature. You would need to delete out the macro feature and then reinsert it with the last argument in InsertMacroFeature3 changed to not embed.
Also note concerning embedded macro features and macros added to the design binder: you cannot edit them once they are added. You have to delete them out, make the changes you want to the macro, then re-insert them. Editing the temp macro file will not modify the macro that is actually embedded in the part.
Thank for your reply, I am using the embed argument and the macro is written in VBA. The problem is when I delete that feature I cannot insert it again for some reason. Its really hit or miss, sometimes it will work and other times it doesn't. Thats why I was curious if it had something to do with temp files.
Here is the code that inserts the macro feature and the embed argument:
Dim MacroFeatOptions As Long
MacroFeatOptions = swMacroFeatureOptions_e.swMacroFeatureAlwaysAtEnd + _
Set cmd_MacroFeat = swFeatMan.InsertMacroFeature("Stock block", "", _
(MacroMethods), (ParamNames), (ParamTypes), (ParamValues), _
I cannot seem to figure out why this macro is not inserting everytime it runs.
I forgot to mention another really weird thing, If I run this macro from the VBA editor (Play Button) it works every time with no problems.
What you are describing probably isn't related to macro features. If you run a macro with multiple sub procedures using Tools-->Macro-->Run, SolidWorks doesn't know what sub-procedure to run first (the "entry sub procedure"). In your case, you want it to run the one with InsertMacroFeature3. But it might be running another sub-procedure.
There's a few options.
First, try putting the sub procedure with InsertMacroFeature3 last in your module---assuming you have only one module. I have found that, by default, the last sub procedure in a single-module macro will always get run first.
If you have more than one module in your macro, then you can never rely on the Run button starting with the right sub-procedure. Maybe there is some criteria by which the entry sub procedure is picked, but I don't know what it is. So instead what you need to do is run your macro from a macro shortcut button, because there you can specify your desired entry sub procedure.
Hope this helps.