COM library putFiles giving error on VBA

Advertisement

PeBoe
Joined:
Posts:
14

COM library putFiles giving error on VBA

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

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
33,437
Location:
Prague, Czechia

Re: COM library putFiles giving error on VBA

Your code works for me in VBA 7.0 (Excel 2010). Are you using VBA or VB?

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
33,437
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?

Reply with quote

Advertisement

PeBoe
Joined:
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:

After the small correction, the code runs perfectly !

Thanks a lot for your efficient support :D

Friendly regards

P.Boehm

Reply with quote

Advertisement

You can post new topics in this forum