Inventor VBA User form - Bring in BOM for assembly

Inventor VBA User form - Bring in BOM for assembly

Mild_Annoyance
Contributor Contributor
425 Views
7 Replies
Message 1 of 8

Inventor VBA User form - Bring in BOM for assembly

Mild_Annoyance
Contributor
Contributor

So I will do my best to explain what I am doing. I am very aware that there are multiple ways to do what I am doing and YES I know many of them are far easier than the way I am trying to do it but all of that is besides the fact so without further ado here is where I am at and what I am trying to do.

 

 

I have created a Macro in VBA that pulls up a userform for either a part or an assembly based on the file type. the part user form works flawlessly and pulls all of the information from the part file and autopopulates the form. then the user can fill in the rest of the form with the required information and hit the "Export to Excel" button which then creates a work order based on an excel template. it is big an bulky code that as I get better with coding will absolutely get refined but it works perfectly.

The issue I have is when I am doing the assembly user form I will need to pull in the BOM and populate it into the userform. I would optimally like the BOM of material to populate in some sort of table that has the ability to export different protions of the BOM to certain Excel cells. the only way I have been able to find is to create all different "TextBox" or "ComboBox". I have no problem doing this but I feel there has to be an easier way to do this. I am a begginner in the coding world and I am not looking for someone to do this work for me, I am more interested in guidance so I can learn if that makes sense.

0 Likes
Accepted solutions (1)
426 Views
7 Replies
Replies (7)
Message 2 of 8

A.Acheson
Mentor
Mentor

Hi @Mild_Annoyance 

Could you explain a little more about what section of the BOM you want to export? When I read you wanted the BOM populated to the user from I was immediately thinking you want to replicate the BOM allready in place. This to me seems like duplication of work. Maybe a quick screen shot of what you would like to do as in the end result in excel and other users can guide you to how best to achieve this. 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
Message 3 of 8

jjstr8
Collaborator
Collaborator

@Mild_Annoyance : A little more context would be helpful. That being said, the VBA ListBox supports multiple columns and multi-select. If your end-goal is to export selected rows and selected columns, the multi-column ListBox would work. You would probably need checkboxes at each column to select which ones you want to export. If you want to pull anything from the source BOM when exporting, you'll likely need to reserve a column to hold the BOM row index.

0 Likes
Message 4 of 8

Mild_Annoyance
Contributor
Contributor

@A.Acheson I agree it does seem like a duplication. What I am trying to do is to have the BOM displayed in the userform so the user can review it before exporting it to the next step witch exports those parts in the BOM to an excel template but also gives the user the ability to remove items from export or add additional items.

 

@jjstr8 I have looked into the VBA Listbox and it does seem to do what I am trying to do however there is a registry error the prevents me from adding the additional windows controls to the VBA Toolbox as that function is not included with windows natively. IT has tried but it hasnt gone anywhere and as I am the only one asking I am guessing its not at the top of the list.

 

Currently I am exploring Visual Studio as it has more capabilities than VBA Editor but that is coming with its own issues being something that is well beyond my abilities currently.

0 Likes
Message 5 of 8

jjstr8
Collaborator
Collaborator

I've never had to add the ListBox. Is this the one you're trying to add? Mine is using C:\Program Files\Microsoft Office\Root\VFS\System\FM20.DLL

 

jjstr8_1-1741614936801.png

jjstr8_0-1741614890364.png

 

 

0 Likes
Message 6 of 8

A.Acheson
Mentor
Mentor
Accepted solution

If you want simplicity the route you can do all the removal and manipulation in the exported BOM excel sheet. I ran an an excel vba macro after the fact to filter certain columns and rows to different BOM pages. I'm sure any macros you develop to automate the filtering can be used in your user form approach later. The user form idea would be a nice touch but it is an involved approach and adjusting them later can be a mission.

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes
Message 7 of 8

Mild_Annoyance
Contributor
Contributor

@A.Acheson I appreciate your help. I was afraid it was gettiing to involved and wasnt gonna work.

0 Likes
Message 8 of 8

Mild_Annoyance
Contributor
Contributor

@jjstr8 My apologies, was "Microsoft ListView Control" not ListBox