Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: How to incorporate FileTransferProgress in VBA

Arun wrote:

I am not able to connect FTP .net library via Excel VBA.

Dim mySessionOptions As New WinSCPnet.SessionOptions
With mySessionOptions --- Getting error here ActiveX component can't create object

Did you follow the instructions?
https://winscp.net/eng/docs/library_install#registering
Arun

Re: How to incorporate FileTransferProgress in VBA

Hi @scooper77,

I am not able to connect FTP .net library via Excel VBA.

Dim mySessionOptions As New WinSCPnet.SessionOptions
With mySessionOptions --- Getting error here ActiveX component can't create object

Can you please help me....

scooper77 wrote:

I am using the .net library via Excel VBA to connect and download/upload to my remote server using the Webdav protocol. Everything works. I just need to have the download/upload progress status in the status bar in excel. Looked through some codes in VB and powershell regarding filetransferprogress event/class but cant seem to link the FileTransferprogress into VBA. Can anyone help me on this.

my download code is similar to this and it works great but without any download progress info:

Private Sub download(ByRef mySession As Session)
' Setup session options
Dim mySessionOptions As New SessionOptions
With mySessionOptions
.Protocol = Protocol_Webdav
.HostName = "abcd.com"
.PortNumber = 443
.UserName = "username"
.Password = "password"
.WebdavSecure = True
.TlsClientCertificatePath = "path_to_key"
End With

' Connect
mySession.Open mySessionOptions
NameFile = "name_of_file"
RemotePath = "name_of_file"
Dim transferResult As TransferOperationResult
Set transferResult = mySession.GetFiles(RemotePath, NameFile, False)

' Throw on any error
transferResult.check

' Display results
Dim transfer As TransferEventArgs
For Each transfer In transferResult.Transfers
MsgBox "Downloaded"
Next
End Sub
scooper77

How to incorporate FileTransferProgress in VBA

I am using the .net library via Excel VBA to connect and download/upload to my remote server using the Webdav protocol. Everything works. I just need to have the download/upload progress status in the status bar in excel. Looked through some codes in VB and powershell regarding filetransferprogress event/class but cant seem to link the FileTransferprogress into VBA. Can anyone help me on this.

my download code is similar to this and it works great but without any download progress info:

Private Sub download(ByRef mySession As Session)
' Setup session options
Dim mySessionOptions As New SessionOptions
With mySessionOptions
.Protocol = Protocol_Webdav
.HostName = "abcd.com"
.PortNumber = 443
.UserName = "username"
.Password = "password"
.WebdavSecure = True
.TlsClientCertificatePath = "path_to_key"
End With

' Connect
mySession.Open mySessionOptions
NameFile = "name_of_file"
RemotePath = "name_of_file"
Dim transferResult As TransferOperationResult
Set transferResult = mySession.GetFiles(RemotePath, NameFile, False)

' Throw on any error
transferResult.check

' Display results
Dim transfer As TransferEventArgs
For Each transfer In transferResult.Transfers
MsgBox "Downloaded"
Next
End Sub