Main Content

Change Cursor in Spreadsheet

这个服务le shows how to change the cursor icon in an Excel® spreadsheet.

Create a COM server running a Microsoft® Excel application.

h = actxserver('Excel.Application'); h.Visible = 1;

Open the Excel program and notice the cursor.

View the options for theCursorproperty. These values are enumerated values, which means they are the only values allowed for the property.

set(h,'Cursor')
ans = 4×1 cell array 'xlIBeam' 'xlDefault' 'xlNorthwestArrow' 'xlWait'

Change the cursor toxlIBeam.

h.Cursor ='xlIBeam';

Notice the cursor in the program.

Reset the cursor.

h.Cursor ='xlDefault';

Close workbook objects you created to prevent potential memory leaks.

Quit(h) delete(h)

Related Topics