0

Is there a PIA for Office365 and Visual Studio 2010? If so how do I get it? If not then what is the equivalent? There are no PIAs on my PC for Office365 or anything beyond Office 14. Context: I am migrating all my files/Folders from an old PC to a new PC. The systems involved have the following installed: Old: Windows 7(64 bit), Office 2007, Visual Studio 2010 Professional New: Windows 10 (64 bit), Office365, Visual Studio 2010 Professional

Much of my work involves Excel VBA routines calling COM enabled Class Libraries (.dll) to obtain and manipulate various data which the .dlls then return the results to Excel for display and/or other manipulations. The Class Libraries are written by me using VS2010 VB.Net. All of this works as expected on my old PC.

The first sign of my Problem is this Warning: C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(2015,5): warning MSB3304: Could not determine the dependencies of the COM reference "Microsoft.Office.Interop.Excel". Element not found. (Exception from HRESULT: 0x8002802B (TYPE_E_ELEMENTNOTFOUND)) which I get when attempting to rebuild a Class Library assembly with Visual Studio 2010.

Since this was a Warning, I pushed on in Debug mode. My Startup Project is a test application which starts Excel with a test Workbook. In that Workbook, I have code that attempts to set up an instance of my .dll, the .dll that Imports Microsoft.Office.Interop.Excel. It errors out with the message: Error trying to Create the StockDataTest.Tester instance. Error is: runtime error '429: ActiveX component can't create object'.

I suspect that the runtime error is related to the build time Warning and have been searching and poking around based on that suspicion. I suspect that it has to do no PIA for Office365/VS2010. The first time I opened this Solution after copying to the new machine, VS210 changed the old reference to "Microsoft.Office.Interop.Excel". to a reference that actual refers to C:\Windows\assembly\GAC_MSIL\Microsoft.Office.Interop.Excel\15.0.0.0__71e9bce111e9429c\Microsoft.Office.Interop.Excel.dll which is the one that it could not determine the dependencies for.

Any help will be appreciated.

2 Answers2

0

The PIAs for the currently installed version of Office on any machine are located in the GAC. By default, Visual Studio will look for them in its own folders - Visual Studio installs the version of the Office PIAs that are current for its version there.

So you need to use the COM tab to reference a different set of PIAs. The names of the COM PIAs differ somewhat from those installed by Visual Studio. As I recall, they start with "Microsoft", such as "Microsoft.Excel" (I'm currently on a mobile device).

Cindy Meister
  • 25,071
  • 21
  • 34
  • 43
  • Thanks for the response. I cleared up my question of who does what. With that info, it appears that VS chose the right ref to get "Microsoft.Office.Interop.excel" However, that is the the one that gives the Could not determine the dependencies of the COM reference "Microsoft.Office.Interop.Excel". Element not found. Warning and Probably the failed to Create Object error when I try to reference the .dll for my Class Library. Any thoughts? – user3461770 Dec 11 '19 at 18:54
  • @user3461770 Did you actually try changing the references? The project might not necessarily do so (often does not). If that doesn't work, today, on re-reading this has triggered an old memory. I ran into a client project once that exhibited very odd behavior and it turned out the project, itself, was "corrupt" - something was damaged internally. Fixing it involved creating a new project and copying the code (as text) into it. I think the error messages weren't the same as you're seeing, but that would be something to keep in mind. – Cindy Meister Dec 13 '19 at 12:08
  • I found the .dll that was used on the old PC and changed all Refs to use it. That got rid of the "Could not determine the dependencies of the COM reference " Warnings but did not eliminate the 429: ActiveX component can't create object' problem. There are 4 projects in this solution, 3 of which use Microsoft.Office.Interop.Excel. I changed them all. I also tried with VS2019 which gave the same results. My next step is to create a little test project and add Refs until it breaks. I also have another Solution, an Excel AddIn, that uses the same original VS2010 PIA. It works. – user3461770 Dec 14 '19 at 05:44
  • Using VS2019 I created a small Class Library that should interact with Excel. Nothing from any previous efforts was included or referenced by this new Library. I added a reference to "Microsoft.Office.Interop.Excel" by adding C:\Windows\assembly\GAC_MSIL\Microsoft.Office.Interop.Excel\15.0.0.0__71e9bce111e9429c\Microsoft.Office.Interop.Excel.dll, the same that seems to be the newest PIA equivalent and the same that VS chose when rebuilding my original Library. This automatically added a ref to Microsoft.Office.Core. When Built, same dependencies Warning and same -429 error ????? – user3461770 Dec 19 '19 at 22:23
0

The problem was solved by uninstalling my 64-bit version of Office 365 and installing the OFF-LINE version as 32-bit. After very limited tweaking to accommodate the 32-bit version, the problem was solved. I am not sure if the Off-Line install or the change to 32-bit or if both changes were required.