Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
souadouert
Specialist
Specialist

Macro Qlikview data to FTP

Hello

i used this code to copy a file to the SFTP no error displayed when i running the macro  but the file is not copied

Sub FTPUpload

Set oShell = CreateObject("Shell.Application")

Set objFSO = CreateObject("Scripting.FileSystemObject")

'Path to file or folder to upload

path = "C:\Users\Documents\AJOUUUTTTTT.TXT"

 

On Error Resume Next

Const copyType = 16

'FTP Wait Time in ms

waitTime = 80000

'Configuración FTP

FTPUser = "**************"

FTPPass = "**************"

FTPHost = "172.28.70.151"

FTPDir = "**************"

strFTP = "ftp://" & FTPUser & ":" & FTPPass & "@" & FTPHost & FTPDir

Set objFTP = oShell.NameSpace(strFTP)

'Upload single file

If objFSO.FileExists(path) Then
MSGBOX 'test'
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

 

1 Reply
marcus_sommer

It looked that you used this code-example: FTP Connect and Upload Code Script. Assuming that this code is really working it seems that your FTP-path variable isn't quite correct - you may return it within a msgbox and putting the result within the windows explorer to check if the access in general worked.

If the path is really correct and it didn't work it could be caused from not appropriate user-rights (maybe you could check it with another one) or that the connection is blocked from any security tool like a firewall or rules to the open ports or similar stuff.

- Marcus