Class Not Registered error in VBA
I’m trying to control WinSCP from Excel running on Windows 10. I have written a large VBA program which includes using WinSCP to download files from a web site. This program has worked fine until fairly recently.
However, during the past two months I’m getting the error “Class Not Registered”.
I have reported this problem some time ago, but I cannot find the report. Perhaps you can find it. I don’t think the previous report will help us here. You suggested I run
To simplify matters I have written a very small VBA macro in Excel. This macro shows the problem, and is included here in this problem report.
I have single-stepped the macro and taken screenshots of what happened. In the text that follows, there are references to screenshots. They are numbered 01 to 09, and are included in the zip file Problem Report.zip.
Here is the version of Excel I am using. I believe that it is the current version for Windows 10.05
Here is the version of Windows I am using. I believe all updates are installed.
Here is the computer I am using.
Here are the references in Excel. This shows that the DLL file is registered.
Here is the version of WinSCPnet.dll I am using.
Also, I have verified that WinSCP stand-alone (not controlled by VBA) works just fine.
However, during the past two months I’m getting the error “Class Not Registered”.
I have reported this problem some time ago, but I cannot find the report. Perhaps you can find it. I don’t think the previous report will help us here. You suggested I run
/comregistration
to get rid of previous registrations. I have done this successfully and have verified the deletions. Then I verified the registrations and that WinSCPnet.dll
functions are present. I can provide screenshots of all the steps I took if that would be helpful.
To simplify matters I have written a very small VBA macro in Excel. This macro shows the problem, and is included here in this problem report.
Option Explicit Sub MyTest1() Dim Mysessionoptions As New Session Mysessionoptions.Protocol = Protocol_Sftp Stop End Sub
- When I start execution of the macro on the second step (before executing it), VBA shows the step in yellow.
01 Before Execution
- When I start execution of the second step, VBA immediately stops with an error on the executable statement (shown in yellow).
02 After Execution
- I cleared the error and started the macro again. When I got to the statement with the error, I did not execute it. I deleted
Session
word from theDim
statement and began to type in the word session. I immediately got the display of the available options. You can see from the screenshot (03 DIM Statement
) thatSession
is available (in addition toSessionOptions
and otherWinSCPnet.dll
options. I believe this proves that theWinSCPnet.dll
is present and therefore, the registration was successful.
- I clicked on the
Session
option and the macro again came to the error statement. I believe this shows that theDim
statement was correctly interpreted by VBA and that, so far, we are not dealing with a VBA software error.
- Next, we consider
Mysessionoptions
statement. Looking at the local’s window, we see that the variableMysessionoptions
is defined. There is no VBA error here.04 Session Options
- I again executed the error statement and got the “Class Not Registered” error.
- You can do the same thing to verify what I have done.
Here is the version of Excel I am using. I believe that it is the current version for Windows 10.05
Excel Version
Here is the version of Windows I am using. I believe all updates are installed.
06 Windows Version
Here is the computer I am using.
07 Computer Version
Here are the references in Excel. This shows that the DLL file is registered.
08 References
Here is the version of WinSCPnet.dll I am using.
09 DLL File
Also, I have verified that WinSCP stand-alone (not controlled by VBA) works just fine.