Delay for SendKeys, TsTom?

MrWeb

New Member
Joined
Jul 24, 2008
Messages
1
Hi!

I am using Sendkeys for Hyperion Planning Excel Add-In User Interface in order to automate retrieving data from the database. Sometimes the UI is too slow and I'd need a little pause between Sendkeys commands. The most helpful solution was provided by TsTom year 2003 in this Forum, see http://www.mrexcel.com/archive2/42000/48659.htm. However, it doesn't work in the UI window of Hyperion Add-In, only after closing the UI window and before opening another UI window. I need a pause inside the UI window. I've used three days for solving this problem and this forum is my last hope ;)

TsTom's almost working 5-years old solution in brief:
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Dim lngCounter As Long
Do While lngCounter < 6000
lngCounter = lngCounter + 1
Sleep 100 'wait for 1/10th second
DoEvents 'yield processes
Loop

-MrWeb
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Looks like you are on to a loser there. Many things tend to stop a macro running until Excel is the active application.

You may be able to run the application directly from Excel. Running external applications from Excel is not a simple job - and made difficult by things like variations in server speed.

The upside is that even if it does not work 100% users prefer it to manual input.

It is usually easier to start from a certain screen in the app. rather than start at the login. Can then keep going back to it as necessary.

Sometimes the API Keypress is better than Sendkeys because it does not need delays. It is a bit more complicated though.

Below are 2 sets of code. The simple one contains most of the basics. The other one is there as a large working example. It also contains code for mouse selection etc.

You will see that I prefer to use Application.Wait rather than Sleep.

Hope this helps.

Simple. Contains most of the basics
API & SENDKEYS RUN EXTERNAL APPLICATION (PRINT MULTIPLE SCREENS)
http://www.mrexcel.com/board2/viewtopic.php?t=170917

Much more complicated. Extract data from emails to enter into SAP. Contains Mouse actions.
API CALLS & SENDKEYS - SAP MACRO
http://www.mrexcel.com/board2/viewtopic.php?p=791077
 
Upvote 0

Forum statistics

Threads
1,214,868
Messages
6,122,005
Members
449,059
Latest member
mtsheetz

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top