Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: WinSCP.dll Registration issues - want to use with VBA

WinSCP .NET assembly is .NET assembly ;) with COM support.
So it behaves like a COM library when it comes to Excel VBA.
I do not know about the CreateObject approach (I know it works in VBScript, haven't tested it in VBA).
But as for the New Session approach, this works for me (tested this myself from Excel VBA).
That's all I can tell.
sy27295

Re: WinSCP.dll Registration issues - want to use with VBA

No, no, no..... with all due respect (btw: Thank you so much for doing all this work + highest respect for your talents, etc.)

Looks like the current COM wrapper is actually a .NET wrapper (with Framework assemblies)

There is also Type Library /.dll wrappers (Pre .NET days).... where you could create an object (say VBScript/VBA without the Office Interop) without the need for Framework or VS.

Check your Excel .....steps:
- Excel
- Alt/F11 (you will see the code)
- Tools
- References

Then this code in a Module should have worked without a 429 error
sub testingWinScpObject
Set session = CreateObject("WinSCP.Session")
end sub
martin

Re: WinSCP.dll Registration issues - want to use with VBA

Ok, so you obviously need to start with this:
https://winscp.net/eng/docs/library_vb
(particularly regarding object instantiation)
sy27295

Re: WinSCP.dll Registration issues - want to use with VBA

Good points.
This is what I want to do .... from Excel and its own VBA; but get Error 429, which means it cannot CreateObject
Not calling from .NET and Assembly, etc.
Set session = CreateObject("WinSCP.Session")
Set session = CreateObject("WinSCPNet.Session")
...assuming that the COM registered ProgramId is one of the above.

Similar to this; similar to what you do from VBScript
Set oFs = CreateObject("Scripting.FileSystemObject")

Tools References dialog box in Excel shows (Type Library?)
[x] WinSCP console interface .NET wrapper

I was hoping to see something without the .NET, as non of my other references (ie. other Microsoft COM products, MapPoint, Outlook), they don't need Framework.

I was under the impression that there is WSP Com Wrapper (uses RegSvr.exe/RegSvr32.exe) and also a .NET wrapper (using RegAsm.exe)

Wonder if this is a "location or environment variables" issue.... but everything is in one folder - the installation folder of WSP (the .exe, the .dll, the .tlb)
martin

Re: WinSCP.dll Registration issues - want to use with VBA

sy27295 wrote:

But I want WinSCP.dll registered.

What do you mean by "registered"? That's what regasm does.

But I want to see WinSCP.dll interface, not WinSCPNet.dll

What do you mean by "WinSCP.dll interface" as opposite to WinSCPNet.dll? Do you want to use 5.1.x instead of 5.2.x? Note that both versions behave the same in terms on "registration" (for COM).

Tried ...windows\system32\regsvr32.exe for WinSCP.dll; but it gives an error.... "..WinSCO.dll was loaded but the entry-point DllRegisterServer was not found.

regsvr32 cannot be used for .NET assemblies. That's what regasm is for.
sy27295

WinSCP.dll Registration issues - want to use with VBA

I did install the COM interface files, etc. at the same place as the WinSCP.exe

This is a 64 bit machine with Office 2010 x64. Want to program in VBA

Tried to register both ways RegAsm.exe [first] (as follows at the bottom and it worked)...for WinSCPNet is now in Excel Tools | References list. But I want WinSCP.dll registered.

But I want to see WinSCP.dll interface, not WinSCPNet.dll
Tried ...windows\system32\regsvr32.exe for WinSCP.dll; but it gives an error.... "..WinSCO.dll was loaded but the entry-point DllRegisterServer was not found.

What am I doing wrong?
Should I delete the RegAsm.exe registration and try RegSvr32 first?

U:\>%WINDIR%\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe "C:\Program Files (x86)\WinSCP\WinSCP.dll" /codebase /tl
Microsoft .NET Framework Assembly Registration Utility version 4.0.30319.17929
for Microsoft .NET Framework version 4.0.30319.17929
Copyright (C) Microsoft Corporation. All rights reserved.

Types registered successfully
Assembly exported to 'C:\Program Files (x86)\WinSCP\WinSCP.tlb', and the type library was registered successfully