ashokkumar1234
New Member
- Joined
- Dec 21, 2017
- Messages
- 1
I am trying to develop code for save the file in sftpcf (winscp) server but error in <code style="margin: 0px; padding: 1px 5px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: 13px; line-height: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; vertical-align: baseline; background-color: rgb(239, 240, 241); white-space: pre-wrap;">Session</code> and showing error as
any suggestion would be appreciated.
<code style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; vertical-align: baseline; white-space: inherit;">PrivateSub Upload(ByRef mySession As Session,ByRef wb1 As Workbook)'error line
Dim wb As Workbook
Set wb = Workbooks(wb1)
' Setup session options
Dim mySessionOptions AsNew SessionOptions
With mySessionOptions
.Protocol = Protocol_SFTP
.HostName ="103.231.8.66"
.UserName ="sftpcf"
.Password ="5|\/35TaR230@%"
.SshHostKeyFingerprint ="ssh-ed25519 256 df:94:44:56:1b:c2:75:8b:b4:58:3a:e2:ef:2e:0d:78"
EndWith
' Connect
mySession.Open mySessionOptions
' Upload files
Dim myTransferOptions AsNew TransferOptions
myTransferOptions.TransferMode = TransferMode_Binary
Dim transferResult As TransferOperationResult
Set transferResult = mySession.PutFiles(wb1,"/home/sftpcf/",False, myTransferOptions)
' Throw on any error
transferResult.Check
' Display results
Dim transfer As TransferEventArgs
ForEach transfer In transferResult.Transfers
MsgBox "Upload of "& transfer.FileName &" succeeded"
Next
EndSub</code>
user defined type not defined
I am not sure below code working or not and I copied the code from internet source.
any suggestion would be appreciated.
<code style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; vertical-align: baseline; white-space: inherit;">PrivateSub Upload(ByRef mySession As Session,ByRef wb1 As Workbook)'error line
Dim wb As Workbook
Set wb = Workbooks(wb1)
' Setup session options
Dim mySessionOptions AsNew SessionOptions
With mySessionOptions
.Protocol = Protocol_SFTP
.HostName ="103.231.8.66"
.UserName ="sftpcf"
.Password ="5|\/35TaR230@%"
.SshHostKeyFingerprint ="ssh-ed25519 256 df:94:44:56:1b:c2:75:8b:b4:58:3a:e2:ef:2e:0d:78"
EndWith
' Connect
mySession.Open mySessionOptions
' Upload files
Dim myTransferOptions AsNew TransferOptions
myTransferOptions.TransferMode = TransferMode_Binary
Dim transferResult As TransferOperationResult
Set transferResult = mySession.PutFiles(wb1,"/home/sftpcf/",False, myTransferOptions)
' Throw on any error
transferResult.Check
' Display results
Dim transfer As TransferEventArgs
ForEach transfer In transferResult.Transfers
MsgBox "Upload of "& transfer.FileName &" succeeded"
Next
EndSub</code>