I recently started a project in Visual Studio 2013 and I referenced a few DLLs from my old project in Excel. Everything was referenced just fine at first, but then when I started up my PC today I noticed that MSForms was no longer recognized even though it was referenced.
I've tried rebuilding the project, restarting the project, starting a new project, resetting settings to default, deleting settings files and reinstalling Visual Studio, restarting my PC, reinstalling Visual Studio with old settings, moving the DLL and referencing it again, tried running the program in 32 bit mode, etc.
I've been messing with this issue for several hours, and I've been Googling and checking these forums for possible solutions. The strange thing about it, is that this a default Windows DLL, it's not downloaded... Also this DLL works just fine in the Excel-VBA, but it refuses to work in Visual Studio 2013.
At first I thought it was just MSForms, but after checking through some of the other referenced DLLs I noticed that Winhttp and a few other ones were not working either, but.. Imagemagick works fine, and that is a 3rd party library. At this point I am stumped, anyways I'll toss some code and images of the references in the area below.
Dim test As MSForms.DataObject <--- Tells me that it isn't defined
These are the references that are currently in the program, so it seems like it has been referenced and yet it doesn't seem to actually load.
Update:
Winhttp seems to be working now, but MSForms is still broken. MSForms still works perfectly fine in Excel, and yet Visual Studio has an issue with it.
The namespace name for the declarations in that COM server is not MSForms
. Your old project might have accidentally relied on a temporary type library that VBA generates named "MSForms.exd". That was a bad idea, that file of course is highly unlikely to still be around. So this code is expected to not compile.
Copy/paste this at the top of the source code file to get ahead:
Imports MSForms = Microsoft.Vbe.Interop.Forms