This is a follow-up to my previous Question about GetObject This code:
Dim wb As Object ' Lotus123.Document
wb = GetObject("S:\Temp\T\0375D.WK3", "Lotus123.Workbook")
Works fine in VBA but fails in VB.net with the error: FileNotFoundException: "File name or class name not found during Automation operation."
I checked out the process with Process Monitor and found: Both VBA and VB.net check these keys:
HKCR\Lotus123.Workbook\CLSID\(Default)
HKCR\CLSID\{29130007-2EED-1069-BF5D-00DD011186B7}
HKCU\Software\Classes
Then VB.net simply stops
But VBA keeps on going with these keys
HKLM\SOFTWARE\Microsoft\COM3\REGDBVersion
HKCR\CLSID\{29130007-2EED-1069-BF5D-00DD011186B7}\InprocServer32 NAME NOT FOUND
HKCR\CLSID\{29130007-2EED-1069-BF5D-00DD011186B7}\InprocServerX86 NAME NOT FOUND
HKCR\CLSID\{29130007-2EED-1069-BF5D-00DD011186B7}\InprocServer32 NAME NOT FOUND
HKCR\CLSID\{29130007-2EED-1069-BF5D-00DD011186B7}\InprocServerX86 NAME NOT FOUND
HKCR\CLSID\{29130007-2EED-1069-BF5D-00DD011186B7}\LocalServer32 SUCCESS
HKCR\CLSID\{29130007-2EED-1069-BF5D-00DD011186B7}\LocalServer32\(Default) SUCCESS
The last one gives the reward: Data: c:\lotus\123\123w.exe And VBA goes on to open the 123w.exe program with the specified file.
So why can't VB.net find the class name? I don't understand why it simply quits looking.
There appears to be a mismatch between the file name (gets spreadsheet document) and Lotus123.Workbook which returns the parent of the application object.
The code below works in XP 32 bit as well as in Win8 64 bit. I checked with process monitor what is happening under the hood. CreateObject checks for the CLSID in the registry using the given object. Then it looks up the necessary info using the CLSID.
In VB.net, this doesn't work
Dim wb As Object: wb = GetObject(sFile, "Lotus123.Workbook")
(worked in VBA)In Win8 64bit this
wb = GetObject(sFile)
doesn't work; just hangs.