Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Cannot set VBA object in windows 7

Posted on 2012-03-19
6
Medium Priority
?
312 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
6 Comments
 
LVL 46

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:Corey Scheich
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
Independent Software Vendors: 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 1000 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:
Corey Scheich earned 1000 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

Industry Leaders: 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!

Question has a verified solution.

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

If you get continual lockouts after changing your Active Directory password, there are several possible reasons.  Two of the most common are using other devices to access your email and stored passwords in the credential manager of windows.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This Micro Tutorial will go in depth within Systems and Security in Windows 7 and will go into detail regarding Action Center, Windows Firewall, System, etc. This will be demonstrated using Windows 7 operating system.
The viewer will learn how to successfully download and install the SARDU utility on Windows 7, without downloading adware.
Suggested Courses

879 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