Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Inputbox cancel-button

I am using the following in a macro:

filename = ActiveDocument.GetApplication.

InputBox("Enter name of the file to be saved", "C:\document.txt")



How can I detect if the cancel-button is used? Because I have a preset-value entered, LEN(filename) is still the length of "C:\document.txt". Also filename = False is not working etc.



Thanks, Nor

3 Replies
Not applicable
Author

Hi,

If user hits Cancel button, InputBox function returns empty string "".

This example works for me:

fname=InputBox("Enter your name","Userinput")

if fname = "" then

fname=InputBox("Try it once more!","Userinput")

end if



Hope this helps

Tomas

Not applicable
Author

Thanks for answering.

When I use the InputBox-function as you suggest, I have not found a way to already have an aswer pre-filled in in the inputbox. The other function has this possibility and I found this very usefull.

I've tested your solution and it is working, but not completely what I am looking for.

Nor

Not applicable
Author

If you want a predefined text allready in inbox, use third parametr. Cancel button has same functionality (returns "").

Example:


fname=InputBox("Enter your name","Userinput","Predefined text here:)")