Datei via FTP herunterladen mit Office 2007
18.01.2009 15:20:17
edie
mittels nachfolgenden Codes wird eine test.txt via FTP heruntergeladen und in den
gleichen Ordner abgelegt. Das funktioniert auch prima mit Office 2003.
Nun habe ich die Datei als .xlsm in Office 2007 gespeichert und die Ribbons- Mehrfunktionsleiste
angepasst. Die test.txt wird zwei Ordner-Ebenen höher abgelegt und mit dem Namen VBA ohne
die Endung .txt . Weis jemand Rat und kann helfen?
Option Explicit
Public Const PROCESS_QUERY_INFORMATION = &H400
Public Const WAIT_TIMEOUT = &H102&
Declare
Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, _
ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Declare
Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, _
ByVal dwMilliseconds As Long) As Long
Sub Win32WaitTilFinished(ProgEXE As String)
Dim ProcessID As Long
Dim hProcess As Long
Dim retVal As Long
ProcessID = Shell(ProgEXE, vbHide)
hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, False, ProcessID)
Do
DoEvents
retVal = WaitForSingleObject(hProcess, 50)
Loop Until retVal WAIT_TIMEOUT
End Sub
Sub FTP(control As IRibbonControl)
Dim Path$
Path = ThisWorkbook.Path
Close
Open "d:\logIn.txt" For Output As #1
Print #1, "Testserver"
Print #1, "audi"
Print #1, "cd Data"
Print #1, "cd test"
Print #1, "ascii"
Print #1, "get test.txt" & " " & Path; "\" & "test.txt"
Print #1, "quit"
Close
Call Win32WaitTilFinished("ftp -s:d:\login.txt 192.168.1.1")
'Kill "d:\login.txt"
End Sub
Was muss ich bei Office 2007 neu berücksichtigen bzw. ändern?
Vielen Dank im Voraus.
Grüße