Class Not Registered error in VBA

Advertisement

DaveBrower
Joined:
Posts:
5
Location:
Calabasas

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 /nonregistration 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
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.
1. When I start execution of the macro on the second step (before executing it), VBA shows the step in yellow. 01 Before Execution
2. When I start execution of the second step, VBA immediately stops with an error on the executable statement (shown in yellow). 02 After Execution
3. 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 the DIM 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) that Session is available (in addition to Session Options and other WinSCPnet.dll options. I believe this proves that the WinSCPnet.dll is present and therefore, the registration was successful.
4. I clicked on the Session option and the macro again came to the error statement. I believe this shows that the DIM statement was correctly interpreted by VBA and that, so far, we are not dealing with a VBA software error.
5. Next, we consider Mysessionoptions statement. Looking at the local’s window, we see that the variable Mysessionoptions is defined. There is no VBA error here. 04 Session Options
6. I again executed the error statement and got the “Class Not Registered” error.
7. You can do the same thing to verify what I have done.
It seems to me that there must be something wrong with WinSCPnet.dll or possibly the operating system. Can you help?
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.
Description: Contains screenshots 01 through 09

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
35,996
Location:
Prague, Czechia

Re: Class Not Registered error in VBA

Restart your machine and post what does WinSCP with /comregistration parameter show.

Reply with quote

DaveBrower
Joined:
Posts:
5
Location:
Calabasas

Reply to Martin

Martin:
Thank you for looking at this problem. I am sending you a text file of the entire CMD screen when I executed WinSCP.com /comregistration. The file name is: First Problem Reply.txt. I look forward to hearing from you.
Description: Text file of CMD screen on execution of WinSCP.com /comregistration

Reply with quote

Advertisement

martin
Site Admin
martin avatar

Re: Reply to Martin. Windows is 64-bit, Excel is 32-bit.

Sorry, I do not know how to help you. This is beyond my knowledge.
For test, I've followed the instructions step-by-step now, and everything works as expected (I have 64-bit Excel, but I do not think it's related).
https://winscp.net/eng/docs/library_vb

Reply with quote

Advertisement

You can post new topics in this forum