Solved

Cannot set VBA object in windows 7

Posted on 2012-03-19
6
293 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 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
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 
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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

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…
By default the complete memory dump option is disabled in windows . If we want to enable the complete memory dump for a diagnostic purpose, we have a solution for it. here we are using the registry method to enable this.
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 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.

770 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