Changing the Cursor in VBA

The Application object has a Cursor property that you can use to change the appearance of the cursor in your VBA programs. You use it like

Application.Cursor = xlWait

The valid settings are
xlDefault
xlBeam
xlNorthwestArrow
xlWait

Be sure to set it back to xlDefault when you’re done monkeying with it.

2 Comments

  1. Roger Wray says:

    I am using VBA and I want to change the cursor when it passes over a ‘label’ to the Windows default hand and it is not in the drop down list in ‘properties’. How can I do this?

    Thanks
    Roger

  2. Jon Peltier says:

    Roger -

    Userform controls and worksheet controls from the Controls Toolbox have a MousePointer property, with a set of built-in options (more than the application.cursor choices above). If the option you want isn’t there, set MousePointer to 99 - fmMousePointerCustom, then use the MouseIcon property to pick out a graphic file to use.

Posting code or formulas in your comment? Use <code> tags!

  • <code lang="vb">Block of code goes here</code>
  • <code lang="vb" inline="true">Inline code goes here</code>
  • <code>Formula goes here</code>

Leave a Reply