Solved

Excel VBA - need a reliable method for SendKeys Number lock

Posted on 2016-11-28
4
50 Views
Last Modified: 2016-12-01
I see that {Numlock} toggles the Number lock.

I'm looking for a reliable way to ensure that, after my Sendkeys {Down} which sometimes leaves Number Lock state as 'off', to ensure that it is returned to Number Lock 'on'.

Thanks.
0
Comment
Question by:hindersaliva
4 Comments
 
LVL 45

Assisted Solution

by:aikimark
aikimark earned 125 total points
ID: 41904565
You can get the state from the GetKeyState Windows API
1
 
LVL 69

Accepted Solution

by:
Qlemo earned 250 total points
ID: 41904608
You know that SendKeys and reliable are contradictory? You should avoid using SendKeys as much as possible.
1
 
LVL 6

Assisted Solution

by:Mike in IT
Mike in IT earned 125 total points
ID: 41904704
I agree with Qlemo, you should avoid SendKeys. It is not reliable. Here is a link to a possible way to work around it with an API.
0
 

Author Closing Comment

by:hindersaliva
ID: 41909035
Thanks. I've taken Qlemo's advice and am NOT using SendKeys.
I shall try Mike in IT's link later.
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Access 2016 7 35
"Fit to Drawing" different Layers 7 25
Formatting Undefined Number of Worksheets in a Workbook with VBA Macro 14 41
Excel error  #DIV/0! 7 19
A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question