Discussion Board for collaboration on QlikView Scripting.
Is it possible to define a variable, to be used in sub / macro?
I have a file path hardcoded in a macro, but if I want this to change, I don't really want to search the script for all instances of it.
I know in SAS, SQL etc...I can use a macro variable & state it at the top. Is this possible with VBScript?
Something like this I want to do:
FilePath = C:\user\document\pictures
dim fsoSet fso =CreateObject("Scripting.FilesystemObject")fso.CreateTextFile "FilePath\dummy.txt"
Go to Solution.
Create a variable in front end and assign the variable in inputbox. You can change the path whenever required,
You can use below code to fetch the path from front end variable.
FilePath = ActiveDocument.GetVariable("vPath").GetContent.String
FileDate = ActiveDocument.Evaluate("date(Now(), 'DDMMYYYY hhmmss')")
If Right(FilePath,1)<> "\" then
FilePath = FilePath & "\"
Set fso =CreateObject("Scripting.FilesystemObject")
fso.CreateTextFile FilePath & "dummy_" & FileDate & ".txt"
Sample attached fro your reference.
If you want to hardcode the path use below code.
FilePath = "C:\user\document\pictures"
fso.CreateTextFile FilePath & "\Dummy.txt"
Thank you..... perfect solution & I got it working!