Solved

Cannot set VBA object in windows 7

Posted on 2012-03-19
6
291 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 83

Assisted Solution

by:CodeCruiser
CodeCruiser earned 250 total points
Comment Utility
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
Comment Utility
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
Comment Utility
Thank you, Corey2. I will try FuselogVW and get back with the results.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
OfficeMate Freezes on login or does not load after login credentials are input.
This Micro Tutorial will give you a basic overview of Windows Live Photo Gallery and show you various editing filters and touches to photos you can apply. This will be demonstrated using Windows Live Photo Gallery on Windows 7 operating system.
The viewer will learn how to successfully download and install the SARDU utility on Windows 7, without downloading adware.

762 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now