Topic "Using VBA to sync files"

Author Message
mezentia
[View user's profile]

Joined: 2013-09-16
Posts: 2
Location: Smethwick, UK
Can anyone provide me with an example of how to code file synchronisation from a remote device to a local directory using just VBA? I'm writing an Access 2010 app that needs to perform the synch automatically when the app loads - currently I'm doing this manually. I've seen some examples for putting files with FTP, but so far I can't work out how to create a similar function to do a local synch.
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
One of these may help you:
https://winscp.net/eng/docs/guide_automation_advanced
https://winscp.net/eng/docs/library_vb
_________________
Martin Prikryl
mezentia
[View user's profile]

Joined: 2013-09-16
Posts: 2
Location: Smethwick, UK
I've seen those two pages. I've downloaded and registered the VB.Net stuff, and I can add the reference to my Access application. However, VB.NET and VBA are different languages, and I can't see how to convert the VB.Net example to VBA Confused Is there a VBA equivalent example for synchronising files?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
mezentia wrote:
I've seen those two pages. I've downloaded and registered the VB.Net stuff, and I can add the reference to my Access application. However, VB.NET and VBA are different languages, and I can't see how to convert the VB.Net example to VBA Confused Is there a VBA equivalent example for synchronising files?

The second link is about VBA. And the first is general, while using different languages, it can be translated to VBA too.

Last edited by martin on 2013-12-17; edited 1 time in total
sy27295
[View user's profile]

Joined: 2013-12-04
Posts: 12
Location: Boston, USA
I had the same issue.
As far as I know .... the winScp wrapper is for .NET interop; therefore, the Type Library object is not callable from Excel's Tools | Reference .... it can only be used from Visual Studio.

However, I still have this outstanding question ... what about the VBScript (sample + presumably/actually working code). Creating a COM Object from (pure) VBA and VBScript is pretty much the same thing.

prikryl wrote:
mezentia wrote:
I've seen those two pages. I've downloaded and registered the VB.Net stuff, and I can add the reference to my Access application. However, VB.NET and VBA are different languages, and I can't see how to convert the VB.Net example to VBA Confused Is there a VBA equivalent example for synchronising files?

The second link in about VBA. And the first is general, while using different languages, it can be translated to VBA too.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
sy27295 wrote:
I had the same issue.
As far as I know .... the winScp wrapper is for .NET interop; therefore, the Type Library object is not callable from Excel's Tools | Reference .... it can only be used from Visual Studio.

That's just not true. The example at https://winscp.net/eng/docs/library_vb is well tested using various versions of Microsoft Excel.

What particular step are you having problem with?
sy27295
[View user's profile]

Joined: 2013-12-04
Posts: 12
Location: Boston, USA
What I was trying to say....
VBA without the .NET framework
VBA from within Excel (or any other Office Module; no framework, no VisStudio)
VBA that could be used in Win '95, etc... before .NET Office Interop was created

I think that's where the confusion was

Cornelia
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
sy27295 wrote:
What I was trying to say....
VBA without the .NET framework
VBA from within Excel (or any other Office Module; no framework, no VisStudio)
VBA that could be used in Win '95, etc... before .NET Office Interop was created

I'm not an expert in this. But I believe that this has nothing to do with .NET Office interop. WinSCP .NET assembly is COM library, no matter if it is implemented using .NET framework. So as long as you have .NET framework (so that the assembly can execute), no support on Excel-side is needed for .NET. From Excel perspective, the assembly is COM library as any other. But of course .NET framework is not supported on Windows 95.
sy27295
[View user's profile]

Joined: 2013-12-04
Posts: 12
Location: Boston, USA
>>>I'm not an expert in this. <<<
Ok, ok .... now got it.
Looks like the automation DLL does not do pure VBA.
Just for your info.... there are and will be some questions about VBA (outside of the .NET Assembly usage). It is very easy to see what it is.... Open Excel, Hit Alt-F11 .... there it is, VBA environment without the Framework.
Some people may be talking about this, when they say VBA.
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License