Renamed VBA macros/buttons won't go away

Renamed VBA macros/buttons won't go away

DRoam
Mentor Mentor
478 Views
4 Replies
Message 1 of 5

Renamed VBA macros/buttons won't go away

DRoam
Mentor
Mentor

I have a couple VBA macros in my Application Project (which is on a shared network drive) that I gave the wrong name a while back and placed as buttons on the ribbon. Today I finally decided to give them the correct name.

 

So I opened the VBA editor and renamed the subs, then saved my project. Then I went into Customize, removed the old macro button, and replaced it with the new correctly-named one.

 

Then I restarted Inventor, checked the ribbon tab that has my button... and there the old button was again, with the silly typo staring back at me. I checked in Customize and indeed, my new macro was sitting in the available Macros list, but so was the old macro. And when I selected the Ribbon tab that contains my button from the "Choose tab to add custom panel to" list, it showed the old macro again, like I'd never changed it to the new one.

 

I tried this 3 or 4 times, including breaking it up by just removing the old button, restarting, then adding the new button, but the old button always came back after I restarted.

 

I checked my VBA project, and the sub rename did save correctly, so it's not an issue with the VBA project.

 

So apparently my ribbon customizations aren't being preserved on restart. And my old macros are still lurking somewhere under the hood even though they're not in my VBA project anymore.

 

What would cause this to happen and how can I fix it?

 

EDIT: I'm running Inventor 2017.4.4 on Windows 10.

0 Likes
479 Views
4 Replies
Replies (4)
Message 2 of 5

DRoam
Mentor
Mentor

So I did some testing, and even if I make my button customization changes, hit "Apply", Export my customize settings, then Import that exact file, the Import makes the customizations go away.

 

So apparently my customizations aren't being written to the under-the-hood customization file at all. 

0 Likes
Message 3 of 5

DRoam
Mentor
Mentor

So I found where the internal Customizations are stored, under "%APPDATA%\Autodesk\Inventor 2017\InventorCustomization.xml", and I used Notepad to manually make my changes. Then I launched Inventor, and my buttons appeared exactly as they should.

 

Then I tried using the Customize to add a button to a tab, and hit Apply. I looked the Customize file in my app data folder and the "Date Modified" didn't change. So then I closed Inventor, and the Date Modified updated. However, when I opened the Customize file, the button I had just added using the Customize dialog was not added to the XML file.

 

So, it appears that Inventor is reading from the InventorCustomizations.xml file just fine, but it's not writing changes to it properly upon exit.

0 Likes
Message 4 of 5

DRoam
Mentor
Mentor

@johnsonshiue, do you know why Ribbon customizations would not be saved to the InventorCustomization.xml file on exit?

 

Is it possible I did something to corrupt the file? Can you provide me with a clean InventorCustomization.xml file so I can try with a clean slate?

0 Likes
Message 5 of 5

DRoam
Mentor
Mentor

Ok so I found a thread saying if you just delete (or rename) the Customization file so Inventor can't find it, it'll create a clean one after you launch and exit Inventor. So I did that, and indeed a fresh XML file was created. Then I did my button customizations again using the Customize dialog, restarted, and sure enough my new buttons were there just as they should be! Problem solved.

 

So apparently my XML file did get corrupted somehow, such that Inventor could read from it fine but couldn't save to it upon exiting Inventor.

 

I've attached my old, corrupted XML file. @johnsonshiue, if you have some tool for looking at that and finding what's wrong with it, I'd love to know what I did to cause this so I can avoid doing it again... 🙂

0 Likes