Topic "COM library putFiles giving error on VBA"

Author Message
PeBoe
[View user's profile]

Joined: 2013-11-07
Posts: 14
Hi

I'm trying to use the COM object in VBA; after successful creation and initialization of a session object which I call m_session I try:

Dim transferResult As TransferOperationResult
transferResult = m_session.putFiles(localPath, remotePath)

also tried:
set transferResult = m_session.putFiles(localPath, remotePath)

But I always get an Error: "object reference not set to an instance of an object"

NOTE: I know m_session is OK, because when using it with m_session.ExecuteCommand('any UNIX cmd') it works fine

Working with:
Microsoft Windows XP Professional; Version 5.1.2600 Service Pack 3 Build 2600
Microsoft Visual Basic 6.5
WinSCP 5.1.7
WinSCP COM Assemmbly 5.1.7

Thanks for your help
PeBoe
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24995
Location: Prague, Czechia
Your code works for me in VBA 7.0 (Excel 2010). Are you using VBA or VB?
_________________
Martin Prikryl
PeBoe
[View user's profile]

Joined: 2013-11-07
Posts: 14
I'm working with Excel 2003 SP3
PeBoe
[View user's profile]

Joined: 2013-11-07
Posts: 14
Sorry, forgot to add: using VBA
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24995
Location: Prague, Czechia
PeBoe wrote:
I'm working with Excel 2003 SP3

I would not expect this to differ between 2003 and 2010.
Anyway, can you post your complete code?
_________________
Martin Prikryl
PeBoe
[View user's profile]

Joined: 2013-11-07
Posts: 14
Sorry Martin

after further playing around with my example code I discovered my error (an uninitialized variable within my method); as often, just a copy/paste error Evil or Very Mad

After the small correction, the code runs perfectly !

Thanks a lot for your efficient support Very Happy

Friendly regards

P.Boehm
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