VSTO & .NET & Excel

April 10, 2009

Sheet Navigation in The Ribbon UI – Part I

Filed under: .NET & Excel, VSTO & Excel — Dennis M Wallentin @ 11:25 am

This is the first post out of two that will be dealing with Sheet Navigation and how we create solutions for it in the Ribbon UI. In my experience sheet navigation is common for large-scale dictator applications but also for smaller application solutions.

The example provided here is based on a VSTO workbook solution which contains five worksheets and the whole solution is showed in the following screen shot:

vsto-workbook-solution

The end user UI is based on four customized images and when the users run the solution the following UI is available:

vsto-workbook-ui

The customized Ribbon UI solution is a basic approach that does not involve any advanced or complext coding. The following procedure is executed when users click on one of the image buttons:

code-vsto-workbook-solution

As we can see we convert the ActiveSheet to an Interop worksheet which gives us access to the Previous and Next methods of the worksheet object. Other then that standard code is being use and should not create any issuse.

In the second post I will discuss more advanced sheet navigation in the Ribbon UI.

Kind regards,
Dennis

About these ads

3 Comments »

  1. Maybe you’re going to deal with this later, but isn’t it friendlier to disable irrelevant controls? For example, if the first sheet is currently active, the ‘First’ and ‘Previous’ ribbon controls should be disabled. This would also make your IF tests redundant.

    Is this possible?

    Comment by Rob Bruce — April 10, 2009 @ 1:08 pm

  2. Nice and Sweet Dennis, very clean. I like it.

    Rob, you’ve got a point, it would be nice to disable the buttons that are no longer viable. This is done using a getEnabled callback.

    There’s a great article that covers this (and more) from MSDN by Ken Getz here:

    http://msdn.microsoft.com/en-us/magazine/cc163410.aspx

    – Mike

    Comment by Mike Rosenblum — April 13, 2009 @ 12:13 am

  3. Hi Guys,

    Thanks Mike, both for Your kind comment as well as for the link to Ken Getz’s article on the subject :)

    I have not in mind to take the route with enabling/disabling for sheet navigation.

    Kind regards,
    Dennis

    Comment by Dennis Wallentin — April 15, 2009 @ 10:54 am


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

The Silver is the New Black Theme. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.

Join 39 other followers

%d bloggers like this: