I am trying to use VBA in Excel 2010 to upload a file to my SFTP server. When I use WinSCP.exe, the file uploads, but only after a message saying "Upload of the file <FileName> was successful, but error occurred while setting the permissions and/or timestamp. If the problem persists, turn on "ignore permission errors" option."
When I try to upload using VBA, I get error number 2146233088, "Cannot create remote file <filename>". I have tried a filepermissions object and setting Otherwrite, Userwrite, and Groupwrite all to True, but it makes no difference:
mySession.Open mySessionOptions
Dim myFilePermissions As New FilePermissions
myFilePermissions.OtherWrite = True
myFilePermissions.UserWrite = True
myFilePermissions.GroupWrite = True
Dim myTransferOptions As New TransferOptions
myTransferOptions.TransferMode = TransferMode.TransferMode_Binary
myTransferOptions.preservetimestamp = False
myTransferOptions.FilePermissions = myFilePermissions
Dim transferResult As TransferOperationResult
Set transferResult = mySession.PutFiles("D:\temp\ADBCopy.bat", "/Distribution/FTFZI/PILOT/*.*", False, myTransferOptions)
' Throw on any error
transferResult.Check
As soon as transferResult.Check runs, it throws the error. What am I doing wrong?