Application.Wait triggering out of turn before Application.SendKeys

  • Hello All -


    Background

    • FactSet is a financial software, similar to Bloomberg. FactSet, again similar to Bloomberg, has a non-native ribbon when the excel addon is installed.
    • The excel shortcut to "Refresh all FactSet formulas" in the workbook, is ALT+S+R+W.

    Macros Purpose

    • When macro is submitted, insert new columns on different tabs.
    • Simulate keyboard submitting of ALT+S+R+W (to update all FactSet formulas in workbook).
    • Macro to wait 20 seconds, in order for FactSet formulas to actually update.
    • Then, proceed with copy/paste information to different tabs etc.

    Macro Issue/Problem

    • At least with how VBA is written now, the application.wait function is being triggered the moment the macro is run, even though in the code, this should occur after application.sendkeys to simulate ALT+S+R+W.

    Thread Purpose

    Has any user seen application.wait go "out of turn" sort of speak? I cannot figure out how to get the macro to pause between simulating ALT+S+R+W, and copy/pasting data to different tabs. Any thoughts?


    VBA (also attached in word doc)

    Moderator Comment: I have added Code Tags to your VBA. Please read the forum rules you agreed to abide by when you joined. These include how to add code tags.


  • Hello,


    To be tested:

    Hope this will help

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Smiley" icon, below, in the bottom right corner :)

  • Just in case, I'd suggest you split the code into two routines and use Application.Ontime at the end of the first one to schedule the second to run in 20 seconds instead of using Wait.

    Rory
    Theory is when you know something, but it doesn’t work. Practice is when something works, but you don’t know why. Programmers combine theory and practice: nothing works and they don’t know why

  • Hi, I'd suggest you use the 'FactSet Office API Type Library' instead of trying to simulate pressing the keyboard shortcut. It will wait for the refresh to finish before continuing the code.

  • Why is my post being delete as spam? Just trying to help here.... i was suggesting using FactSet Office API Type Library...how is this spam?

  • Questions :


    Isn't FactSet a commercial enterprise in the field of Finance ?


    Is the DLL totally free of charge ?


    Where is the free-of-charge link to download it ?


    Where is the installation procedure explained ?

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Smiley" icon, below, in the bottom right corner :)

    Edited once, last by Carim ().

  • The original user mentioned using the FactSet API already. The library i mention is included in the same package and should already be installed one the requester's machine.


    Obviously, it isnt helping anyone without the API already installed.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!