Solved

Cannot set VBA object in windows 7

Posted on 2012-03-19
6
299 Views
Last Modified: 2012-06-21
Hello X-perts,

I have a VB.NET application that is registered as a COM for Excel. In the VBA code it is loaded from Excel as:
   
Public Screening As Qmf.MainForm

Open in new window

-------------
  activation in the sub:
    Set Screening = New Qmf.MainForm
    Call Screening.start(ThisWorkbook.Name, vendorType, locHFI, locQuant, lastS)

Open in new window

The line
Set Screening = New Qmf.MainForm

Open in new window

throws an automation error in Excel VBA with code "One or more arguments are invalid."

Now read the most important part:

1) This is a mature application that works on many PCs with different OS (XP, Win 7, Vista) for years. It works perfectly fine on my other Win 7 64 machine.

2) The problem started when I installed it to a brand new Lenovo laptop with Windows 7. It is the problem with only one particular PC.

3) I tried many things to isolate that error including:
     a) Different versions of MS Office - 2007 and 2010.
     b) Installing the same .NET libraries as on other machines  
     c) Installing Visual Studio
     d) replacing the factory HDD with Win 7 by other HDD from a different PC (also Win 7 64). Obviously, all the drivers were messed up, but the application itself worked perfectly.

4) The COM library is registered without errors, visible in Excel references and there are no compilation errors.

I am out of ideas what to try....

Please help.
0
Comment
Question by:orgrau9
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 45

Expert Comment

by:aikimark
ID: 37741998
What happens if you declare the variable like this?
Public Screening As New Qmf.MainForm

Open in new window

0
 
LVL 13

Expert Comment

by:Corey2
ID: 37743165
Are you registering using the Greatest Version of RegAsm.exe?  If 4.0 is installed and you register using the 2.0 RegAsm things don't work correctly even when the application is built on the 2.0 framework, it has been a long time so I don't remember the specific issues that arrise.

I think it is a little weird that the error sites invalid arguments to a method that doesn't have arguments which seems to point to a problem with the code that runs during the new call.  Have you tried attaching the debugger?
0
 

Author Comment

by:orgrau9
ID: 37744754
It is registered by Install shield as COM dll - there are two libs: dll and tlb.

The problem is related to some missing dependencies for one of the dll, inside that application. I transfer the whole development environment to that "bad PC" to test. When trying to build a solution, it gives an error - "cannot register assembly -- could not load file -- one or more arguments are invalid".

The whole problem is because of some missing assemblies in the pool.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 83

Assisted Solution

by:CodeCruiser
CodeCruiser earned 250 total points
ID: 37774274
Try using the Process Monitor to see what files its trying to access.

http://technet.microsoft.com/en-us/sysinternals/bb896645
0
 
LVL 13

Accepted Solution

by:
Corey2 earned 250 total points
ID: 37774352
Also try using FuselogVW.exe you can copy it from your development pc it's a standalon dll.

http://blogs.msdn.com/b/ianhu/archive/2006/07/12/663834.aspx

It's helped me identify the missing or incompatible reference many times.
0
 

Author Comment

by:orgrau9
ID: 37774488
Thank you, Corey2. I will try FuselogVW and get back with the results.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You may have a outside contractor who comes in once a week or seasonal to do some work in your office but you only want to give him access to the programs and files he needs and keep privet all other documents and programs, can you do this on a loca…
When you try to extract and to view the contents of a Microsoft Update Standalone Package (MSU) for Windows Vista, you cannot extract the files from the MSU. Here we are going to explain how to extract those hotfix details without using any third pa…
In this Micro Tutorial viewers will learn how to use Boot Corrector from Paragon Rescue Kit Free to identify and fix the boot problems of Windows 7/8/2012R2 etc. As an example is used Windows 2012R2 which lost its active partition flag (often happen…
This Micro Tutorial will teach you how to the overview of Microsoft Security Essentials. This is a free anti-virus software that guards your PC against viruses, spyware, worms, and other malicious software. This will be demonstrated using Windows…

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question