Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 
					
				
		
Hi, Community.
I found way to check in VBA if folder exists on PC, but it works only in Excel VBA:
sub Check
If Dir("C:\My Documents\") <> "" Then
MsgBox "Yes, path exists"
Else
MsgBox "No, path does not exist."
End If
end sub
Is there any way to check this stuff in QlikView macro?
Thanks.
 petter
		
			petter
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Since macros in QlikView is using VBScript (or JScript) you don't have the Visual Basic for Applications function called Dir.
An alternative is to use the FileSystemObject in Windows like this:
Set fso = CreateObject("Scripting.FileSystemObject")
foldername = "C:\Program Files (x86)"
On Error Resume Next
Set f = fso.GetFolder(foldername)
On Error Goto 0
MsgBox "The folder [" & foldername & "] do " & Left("NOT",(Len(f)=0)*-3) & " exist"
You have to turn off error messages before the GetFolder function call as it throws an error if not.
Line #3 turns errors off and line #5 turns them on again (as you probably know ... )
 petter
		
			petter
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Since macros in QlikView is using VBScript (or JScript) you don't have the Visual Basic for Applications function called Dir.
An alternative is to use the FileSystemObject in Windows like this:
Set fso = CreateObject("Scripting.FileSystemObject")
foldername = "C:\Program Files (x86)"
On Error Resume Next
Set f = fso.GetFolder(foldername)
On Error Goto 0
MsgBox "The folder [" & foldername & "] do " & Left("NOT",(Len(f)=0)*-3) & " exist"
You have to turn off error messages before the GetFolder function call as it throws an error if not.
Line #3 turns errors off and line #5 turns them on again (as you probably know ... )
 
					
				
		
Wonderful!
Thanks.
