VB.NET: how to build COM DLL with XP Visual styles

andy7789 used Ask the Experts™
Hi x-perts,

I need to build a windows form to be further connected to VBA application vis DLL reference.

I build it in Visual studio as a Class Library. if I select Class Library, the "Enable Application Framework is grayed out" and I cannot select XP visual styles.

If I build it as windows application, I cannot connect it as COM in VBA references.

How can I do this?

To summarize: I need a XP style windows form to me accessible from VBA.

Please, help,


Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
IT Pro/Developer
Top Expert 2008


Let me try this....

it says: "To enable visual styles in the client area of a Windows form, add the following code to your application's Main method."


where exactly should I add it? Into VB.NET code or the VBA code, which calls the form? Where application Main method?


I have just tried this and it doesn't work. The symptoms:

1) If I build that form as a windows application, it shows fine
2) if I build the form as a class and link it as VBA reference (for Excel), it doesn't. I think the problem is that Excel VBA needs some additional reference for control (I saw some mentioning of Common Controls 6, but cannot find it in referfences)

any thoughts?
Jorge PaulinoIT Pro/Developer
Top Expert 2008

I didn't tried yet, and I'm not shure if it works right, but add that in the form load event.


Thanks a lot!!!!!!!!

after a few tries I have managed to get it done by adding


before 1st line of


Thanks again - great help

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial