Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
what i want is a button. behind that button should be a file chooser dialog. After the file is selected a variable is filled with the selected filename including the path of the file. Is this possible?
Hey Amien,
One approach is to add an Action to the button that triggers a macro. In the button properties, select the "Action" tab and click the "Add" button. Choose "External" as the Action Type, and "Run Macro" as the Action. After clicking OK, you will see a text box for Macro Name and a button that says "Edit Module". The Macro Name must be the name of one of the subroutines in your Macro module. Clicking on the Edit module button will bring up the Module editor. You have an option of writing your macro in VBScript or JScript. The rest of what I say assumes you are using VBScript.
Assuming you have the right DLLs/OCXs installed, the following subroutine should open a file chooser dialog and set the result to a variable called "Variable1":
Sub ChooseFile
' Create the dialog
set cd = CreateObject("UserAccounts.CommonDialog")
'Display it to the user
result = cd.ShowOpen
dim filePath
if(result <> 0)
'Assign the result to the filePath variable
filePath = cd.FileName
end if
' Get the QlikView variable
set v = ActiveDocument.Variables("Variable1")
' Assign the value
v.SetContent filePath, true
End Sub
Hey Amien,
One approach is to add an Action to the button that triggers a macro. In the button properties, select the "Action" tab and click the "Add" button. Choose "External" as the Action Type, and "Run Macro" as the Action. After clicking OK, you will see a text box for Macro Name and a button that says "Edit Module". The Macro Name must be the name of one of the subroutines in your Macro module. Clicking on the Edit module button will bring up the Module editor. You have an option of writing your macro in VBScript or JScript. The rest of what I say assumes you are using VBScript.
Assuming you have the right DLLs/OCXs installed, the following subroutine should open a file chooser dialog and set the result to a variable called "Variable1":
Sub ChooseFile
' Create the dialog
set cd = CreateObject("UserAccounts.CommonDialog")
'Display it to the user
result = cd.ShowOpen
dim filePath
if(result <> 0)
'Assign the result to the filePath variable
filePath = cd.FileName
end if
' Get the QlikView variable
set v = ActiveDocument.Variables("Variable1")
' Assign the value
v.SetContent filePath, true
End Sub
For a more complete discussion of the topic, as well as the specific limitations of the approach already mentioned here, please see this thread:
Thanks
http://community.qlik.com/forums/t/23565.aspx
Hi Simon,
i am trying to work on "open/save dialog box" , but not able to get correct solution.
I seen your code but having an doubt how to provide the right DLLs/OCXs installed.
Pls any suggestion regarding this.
Regards
Venkat
This is a workaround using PowerShell for all having problems in 64-bit environments.
Cheers