Help Combining Macro's

I want to start by saying I have absolutely NO IDEA what I’m doing when it comes to the coding part of this. 

 

I have a macro that I want to automatically run when I open a file. 

 

I did some googling and found a code to create the macro that rebuilds everything. Sometimes when I have an assembly open the individual parts don’t rebuild. I have to open them one by one, rebuild each one, then update the assembly. If I run this macro in the assembly, it rebuilds all of the parts without having to open each one. I’ve tested it several times and it works great! 

 

I have another macro that I got from codestack. I followed the instructions and was able to get it to work for what the tutorial was showing which was writing a log file every time the cad file was open. This is the video I followed with success. https://www.youtube.com/watch?v=BTM5NZNdON8

 

The problem now is my ignorance of code. 

 

  • The first screenshot is the one I got from codestack before any editing
    • I know I have to write something where it says ‘TODO……… but I don’t know what.
    • I know it doesn’t like the second “Sub main” but I don’t know why or what I have to change it to. Or just delete it?
  • The second screenshot is the one I got from codestack that I edited just trying to make anything work. I know it's wrong because it didn't work lol. 
    • It didn’t give any errors.
    • It added a feature to the tree in the assembly. 
    • It doesn’t actually do anything other than add to the feature tree. 

 

Attached is a zip file with the screenshots & the macro files. The "Rebuild All Parts" one is the one that works. The "Rebuild All Parts On Open" one is the one I got from codestack and edited.