Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
O código vba abaixo esta correto.
Mas antes de atualizar novos arquivos preciso apagar os arquivos do caminho os arquivos em
FTPDir = "/public_html/teste/conquista/"
Alguma sugestão?
Set oShell = CreateObject("Shell.Application")
Set objFSO = CreateObject("Scripting.FileSystemObject")
'Path to file or folder to upload
path = "C:\tmp\file.csv"
path = "C:\tmp\file1.csv"
Sub FTPUpload
On Error Resume Next
Const copyType = 16
'FTP Wait Time in ms
waitTime = 80000
'Configuración FTP
FTPUser = "xxxxx"
FTPPass = "xxxxxxx"
FTPHost = "xxxxxxxxxxxxx"
FTPDir = "/public_html/teste/conquista/"
strFTP = "ftp://" & FTPUser & ":" & FTPPass & "@" & FTPHost & FTPDir
Set objFTP = oShell.NameSpace(strFTP)
'Upload single file
If objFSO.FileExists(path) Then
Set objFile = objFSO.getFile(path)
strParent = objFile.ParentFolder
Set objFolder = oShell.NameSpace(strParent)
Set objItem = objFolder.ParseName(objFile.Name)
objFTP.CopyHere objItem, copyType
End If
WScript.Sleep waitTime
End Sub
Agnaldo,
normalmente para verificar se tem o arquivo e apagar eu uso o seguinte código
Set filesys = Nothing
Set filesys = CreateObject("Scripting.FileSystemObject")
If filesys.FileExists("XXXXXXXXXXXXXXXXX") then
filesys.DeleteFile "XXXXXXXXXXXXXXXXXX"
End If
ActiveDocument.GetApplication.Sleep 1000
Set filesys = Nothing
Agnaldo,
normalmente para verificar se tem o arquivo e apagar eu uso o seguinte código
Set filesys = Nothing
Set filesys = CreateObject("Scripting.FileSystemObject")
If filesys.FileExists("XXXXXXXXXXXXXXXXX") then
filesys.DeleteFile "XXXXXXXXXXXXXXXXXX"
End If
ActiveDocument.GetApplication.Sleep 1000
Set filesys = Nothing
Obrigado Alessandro