Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Scroll ListBox by Macro with SendKeys PGDN

Dear experts!

I have a question concerning the SendKeys command in QV macro.

We want to scroll a listbox by button. First we set the fokus on it and after this a macro is executed to scroll one page down:

sub makro_sel
set Shell = CreateObject("WScript.Shell")
Shell.SendKeys "{PGDN}"
end sub

But the macro does't work, nothing happens.

Generally the SendKeys command works, i tried this and it's fine:

sub makro_sel
set Shell = CreateObject("WScript.Shell")

Shell.SendKeys "0"
Shell.SendKeys "{ENTER}"

end sub

But the PGDN-Key (and PGUP and DOWN) does not work.

Can someone help me?

Thanks!

1 Solution

Accepted Solutions
Not applicable
Author

 

We will place a good description on the Dashboard to avoid a miscklicking of the users. Unfortunately there is no other way.

By the way – VBA-Code with the Arrow-Keys doesn’t work either.

 

Best wishes

Viktoria

 

View solution in original post

6 Replies
marcus_sommer

In my experience is the use of sendkeys a bad way to execute any action and should be the last measure to achieve anything. In general it's not recommended to use macros within the qlik gui: Macros are Bad.

What is the aim of your macro and which kind of usability should be served with them?

- Marcus

Not applicable
Author

Hi Marcus,

if you have a workaround, you are welcome...

The aim is to scroll a list box one page down by clicking a button.

Thanks in advance,

Markus

marcus_sommer

Why do you want to scroll down within the listbox - what is the aim behind this action?

- Marcus

Not applicable
Author

 

Hi Marcus,

I’ll answer for my colleague.

 

The aim of this action is to jump to the next (page up) or last (page down) item in the listbox by clicking a button. In this case the object must be activated to be able to use page-up or page-down keys, otherwise, depending on activation or selection, you scroll in the wrong place. So that’s why we’ve bound it to a button, which has two actions in this case:

1) activate the object (listbox)

2) run the macro (sendkeys)  

Unfortunately that doesn’t work und that is because this question appears.

 

Thank you in advance, if you have a better solution for us

Viktoria

marcus_sommer

I have tried it myself (by adding the activate-statement within the sendkey-routine) and you are right a selection worked but not PGDN or DOWN. I think those keys are disabled or not implemented within the qlikview-vbs which is reduced in some way (there are some hints to them within the AutomationReference.pdf within your installation).

But until now I couldn't understand why the user don't just used the arrows/pages-keys on the keyboard - what should be the advantages to put this within a button?

- Marcus

Not applicable
Author

 

We will place a good description on the Dashboard to avoid a miscklicking of the users. Unfortunately there is no other way.

By the way – VBA-Code with the Arrow-Keys doesn’t work either.

 

Best wishes

Viktoria