Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I used filetime function with qlikview MACRO to test the file exist
if isnull(filetime("D:\MACROTEST\VISION1.csv")) then
msgbox("")
else
sgbox
end if
and i have this error Type mismatch: 'filetime'
Hi Souad,
You can also try
Sub Test
Set FSO = CreateObject("scripting.filesystemobject")
If FSO.FileExists("D:\MACROTEST\VISION1.csv") = true Then
Msgbox "Yes"
Else
Msgbox "No"
End If
End Sub
Note: You need to enable "Allow System Access" option in the current local security.
May be try something like this
vFileTime = ActiveDocument.Evaluate("If(IsNull(FileTime('D:\MACROTEST\VISION1.csv')), 1, 0)")
If vFileTime = 1 then
msgbox("")
else
sgbox
end if
Hi Souad,
I have tried FileTime() and it works fine. Would be good if you share a sample file.
Otherway you can try using other functions like:
if len(FileSize('file_name')) > 0 THEN
...
ELSE
...
ENDIF
Hope that helps,
Carlos M
Hi Souad,
You can also try
Sub Test
Set FSO = CreateObject("scripting.filesystemobject")
If FSO.FileExists("D:\MACROTEST\VISION1.csv") = true Then
Msgbox "Yes"
Else
Msgbox "No"
End If
End Sub
Note: You need to enable "Allow System Access" option in the current local security.
Hi Sunny,
Hope you are doing good!
I think FileTime function in macro does not work. I believe only chart functions (not script functions) can be evaluated through macro.
You can try any script functions inside the below syntax and you will see "Its not a valid function" error message.
Msgbox ActiveDocument.Evaluate("Any Script Function")
Make sense... I used a chart function before like that, so I thought this might work as well . Thanks for pointing it out tamilarasu