nick_p Posted April 27, 2007 Report Share Posted April 27, 2007 Hello all - I am a new user to ME, and I seem to be running into a wall with this macro I am trying to write. I have searched with key words "arrow key" and "<arrow down>" and didn't find any posts with a similar problem. I am trying to write a macro that will open and mine reports on a daily basis. These reports always have the same first 4 characters in the file name day-to-day, but the rest of the file name is often variable (and semi-unpredictable). So what I am doing to try to get to this report is activate the "Open Report" command from the File menu, type in the first four letters of the report which activates the automatic drop-down menu from which I can select the correct report, then press the down arrow to select the first(and only) report in the drop-down menu, and press enter. This is where I am getting an error. Even though the command seems to work (it's not actually typing out the characters "<ARROW DOWN>"), the arrow key never seems to get pressed, which causes the macro to look for a report named just those first characters, which of course doesn't exist. Can anyone tell me what's going on? Thanks! Nick Quote Link to comment Share on other sites More sharing options...
jason Posted April 27, 2007 Report Share Posted April 27, 2007 In cases like this, it is sometimes just a matter of speed. The macro may be sending the arrow down command before the query has had time to complete. You may want to try breaking up the text type command with a small delay, such as 2 or 3 milliseconds. This should allow the computer ample time to finish the query, fill in the field and then press the arrow down. Quote Link to comment Share on other sites More sharing options...
nick_p Posted April 27, 2007 Author Report Share Posted April 27, 2007 That worked great. Thanks for the tip! Edit: Although I should probably add for anyone with a similar problem, I actually had to put in a delay of about 100 milliseconds, but it's not even noticeable to the naked eye. Quote Link to comment Share on other sites More sharing options...
paul Posted April 29, 2007 Report Share Posted April 29, 2007 And since you're likely to have to introduce such delays into more than one macro, an approach I often use is to store the delay time (e.g. 100 milliseconds) into the registry, and have each relevant macro retrieve that value. Then, if you need to change the value, you need change it only in one place. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.