none
Assistance needed for task help function RRS feed

  • Question

  • Hi all,

    I'm VERY new to VBA and was hoping it would be a walk in the park after learning to program C & C++; how very wrong I was...

    My undergrad dissertation requires that I measure satisfaction of subtle hints for users of Microsoft Excel i.e.  The user will be assigned a task (sort a column by alphabetical order, perhaps?) but if they spend more than five seconds hesitating the computer will assume they need help & display a suggestion that they should click "Sort&Filter" in the "Editing" section of the Ribbon.  If they hesitate again because they can't see the "SortAtoZ" icon, the computer should display a message box recommending they click that icon.

    Please find my program pseudo-coded in comments below.  I have no idea where to start with this particular function so any help would be greatly appreciated to save me having to go through the 1000 page Excel 2010 Power Programming with VBA.

    'WHILE the user has not clicked on "File" tab.
        'Start a timer from five seconds.
        'IF the user clicks on file.
        'Stop the timer.
        'ELSE IF the user doesn't click on "File" tab before the timer reaches zero.
        'Display a MsgBox suggesting they click file if they want to print.
        'END IF
        'END WHILE'

        'WHILE the user has not clicked "Print" tab.
        'Start a timer from five seconds.
        'IF the user clicks on file.
        'Stop the timer.
        'ELSE IF the user doesn't click on Print tab before the timer reaches zero.
        'Display a MsgBox suggesting they click Print tab if they want to print.
        'END IF
        'END WHILE'

        'WHILE the user has not clicked Print icon.
        'Start a timer from five seconds.
        'IF the user clicks on file.
        'Stop the timer.
        'ELSE IF the user doesn't click on Print tab before the timer reaches zero.
        'Display a MsgBox suggesting they click Print icon if they want to print.
        'END IF
        'END WHILE'

    Thanks in advance,

    Joe

    Saturday, February 16, 2013 5:03 PM

All replies

  • The issue that you will encounter is that Excel VBA and Excel are not multi-threaded: for example, running code will disable some Excel user interface functionality, and a user entering Edit mode in Excel will disable VBA, etc.

    I would suggest that you invetigate event class code to capture things like clicking on menu items to set flags and record times, and using the Application.Ontime method to run very short macros codes intermittently, to interfere less with the user interface. A great place to start is Chip Pearson's excellent website - specifially, look at events and application level event coding:

    http://www.cpearson.com/excel/Events.aspx

    http://www.cpearson.com/excel/AppEvent.aspx

    And finally, when you do run into problems that require outside help, post very short, but very specific questions with good background information.

    Saturday, February 16, 2013 9:47 PM