Thema Datum  Von Nutzer Rating
Antwort
21.01.2021 13:13:58 Tatyana
NotSolved
Blau SFTP Download mit Hilfe des WinSCP - Fehler unter Office 2010 und 2013
21.01.2021 13:17:22 Gast52718
NotSolved
21.01.2021 23:49:31 Gast76461
NotSolved
21.01.2021 23:55:42 Gast66658
NotSolved
27.01.2021 10:44:21 Tatyana
NotSolved
27.01.2021 10:42:48 Tatyana
NotSolved
22.01.2021 00:58:44 Gast68561
NotSolved
27.01.2021 10:36:09 Tatyana
NotSolved
27.01.2021 13:46:06 Gast86382
NotSolved
05.03.2021 14:13:20 Tatyana
NotSolved
05.03.2021 14:52:57 Gast12064
NotSolved
05.03.2021 15:41:13 Tatyana
NotSolved
05.03.2021 18:06:30 Gast35810
NotSolved
08.03.2021 11:58:46 Tatyana
NotSolved
08.03.2021 12:07:37 Gast23372
NotSolved
08.03.2021 12:15:17 Gast73204
NotSolved
08.03.2021 12:18:01 Tatyana
Solved
08.03.2021 13:24:43 Gast44459
NotSolved
08.03.2021 13:38:46 Tatyana
NotSolved

Ansicht des Beitrags:
Von:
Gast52718
Datum:
21.01.2021 13:17:22
Views:
563
Rating: Antwort:
  Ja
Thema:
SFTP Download mit Hilfe des WinSCP - Fehler unter Office 2010 und 2013

Hier ist der Beispiel Code

Option Explicit
Public Const cHostName = "example-group.com"
Public Const cUserName = "user_1"
Public Const cPassword = "PW_123_567&89"
Public Const cSshHostKeyFingerprint = "ssh-rsa 2000 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"

Public pErrorMessage As String
Public pMessage As String

' Shell variant
' WinSCP console interface .NET wrapper -> muss nach der Installation von WinSCP bei Extras/Verweise eingebunden sein
' http://winscp.net/eng/docs/library_vb

Private Sub fl_load_SFTP(ByVal strHost As String, _
                         ByVal strUser As String, _
                         ByVal strPW As String, _
                         ByVal strKeyFP As String, _
                         ByVal Transtyp As String, _
                         ByVal FTPOrdner As String, _
                         ByVal Pfad As String, _
                         ByVal FileName As String)
                             
Dim mySessionOptions As New sessionOptions
Dim mySession As New Session
Dim myTransferOptions As New TransferOptions
Dim directoryInfo As RemoteDirectoryInfo
Dim transfer As TransferEventArgs
Dim transferResult As TransferOperationResult

    '--------< fl_Download_SFTP() >--------
    'sftp-Session
    ' Enable custom error handling
    On Error Resume Next
    '< get FileExplorer Functions >
    ' Setup session options

    With mySessionOptions
        .Protocol = Protocol_Sftp
        .HostName = strHost
        .UserName = strUser
        .Password = strPW
        .SshHostKeyFingerprint = strKeyFP
    End With
    '</ get FileExplorer Functions >
    ' Connect
    mySession.Open mySessionOptions
    myTransferOptions.TransferMode = TransferMode_Binary
    Set directoryInfo = mySession.ListDirectory(FTPOrdner)
    Select Case Transtyp
        Case "Download"
            Application.StatusBar = "Downlod der Datei '" & FileName & "' von dem Server '" & strHost & "' läuft!"
            Set transferResult = mySession.GetFiles(FTPOrdner & FileName, Pfad, False, myTransferOptions)
            ' Throw on any error
            transferResult.Check
            For Each transfer In transferResult.Transfers
'                MsgBox "Upload of " & transfer.FileName & " succeeded"
                pMessage = pMessage & "<p></p> Download der Datei '" & Replace(transfer.FileName, FTPOrdner, "") & "' war erfolgreich " & "<o:p>" ' für html Textnachricht, die später an Email body angehängt wird
            Next
        Case "Upload" ' noch nicht getestet
        '    ' Upload files
            Application.StatusBar = "Upload der Datei '" & FileName & "' auf den Server '" & strHost & "' läuft!"
            Set transferResult = mySession.PutFiles(Pfad & FileName, FTPOrdner, False, myTransferOptions)
            ' Throw on any error
            transferResult.Check
            ' Display results
            For Each transfer In transferResult.Transfers
                pMessage = pMessage & "<p></p> Upload der Datei '" & Replace(transfer.FileName, FTPOrdner, "") & "' war erfolgreich " & "<o:p>" ' für html Textnachricht, die später an Email body angehängt wird
            Next
    End Select
    '--< Abschluss >--
    ' Query for errors
    If Err.Number <> 0 Then
'        MsgBox "Error: " & Err.Description
        pErrorMessage = pErrorMessage & "<p></p> Fehler: " & Err.Description & " <o:p>" ' für html Textnachricht, die später an Email body angehängt wird
        ' Clear the error
        Err.Clear
    End If
    ' Disconnect, clean up
    mySession.Dispose
    ' Restore default error handling
    On Error GoTo 0
    '--</ Abschluss >--
    '--------</ fl_Download_SFTP() >--------
Application.StatusBar = False
End Sub

 


Ihre Antwort
  • Bitte beschreiben Sie Ihr Problem möglichst ausführlich. (Wichtige Info z.B.: Office Version, Betriebssystem, Wo genau kommen Sie nicht weiter)
  • Bitte helfen Sie ebenfalls wenn Ihnen geholfen werden konnte und markieren Sie Ihre Anfrage als erledigt (Klick auf Häckchen)
  • Bei Crossposting, entsprechende Links auf andere Forenbeiträge beifügen / nachtragen
  • Codeschnipsel am besten über den Code-Button im Text-Editor einfügen
  • Die Angabe der Emailadresse ist freiwillig und wird nur verwendet, um Sie bei Antworten auf Ihren Beitrag zu benachrichtigen
Thema: Name: Email:



  • Bitte beschreiben Sie Ihr Problem möglichst ausführlich. (Wichtige Info z.B.: Office Version, Betriebssystem, Wo genau kommen Sie nicht weiter)
  • Bitte helfen Sie ebenfalls wenn Ihnen geholfen werden konnte und markieren Sie Ihre Anfrage als erledigt (Klick auf Häckchen)
  • Bei Crossposting, entsprechende Links auf andere Forenbeiträge beifügen / nachtragen
  • Codeschnipsel am besten über den Code-Button im Text-Editor einfügen
  • Die Angabe der Emailadresse ist freiwillig und wird nur verwendet, um Sie bei Antworten auf Ihren Beitrag zu benachrichtigen

Thema Datum  Von Nutzer Rating
Antwort
21.01.2021 13:13:58 Tatyana
NotSolved
Blau SFTP Download mit Hilfe des WinSCP - Fehler unter Office 2010 und 2013
21.01.2021 13:17:22 Gast52718
NotSolved
21.01.2021 23:49:31 Gast76461
NotSolved
21.01.2021 23:55:42 Gast66658
NotSolved
27.01.2021 10:44:21 Tatyana
NotSolved
27.01.2021 10:42:48 Tatyana
NotSolved
22.01.2021 00:58:44 Gast68561
NotSolved
27.01.2021 10:36:09 Tatyana
NotSolved
27.01.2021 13:46:06 Gast86382
NotSolved
05.03.2021 14:13:20 Tatyana
NotSolved
05.03.2021 14:52:57 Gast12064
NotSolved
05.03.2021 15:41:13 Tatyana
NotSolved
05.03.2021 18:06:30 Gast35810
NotSolved
08.03.2021 11:58:46 Tatyana
NotSolved
08.03.2021 12:07:37 Gast23372
NotSolved
08.03.2021 12:15:17 Gast73204
NotSolved
08.03.2021 12:18:01 Tatyana
Solved
08.03.2021 13:24:43 Gast44459
NotSolved
08.03.2021 13:38:46 Tatyana
NotSolved