View Single Post
  #5   Report Post  
Stephen Bullen
 
Posts: n/a
Default

Hi Joseph,

Or maybe there's an easier way to do what I'm trying to do. We're
implementing an Excel Viewer window inside our application. Right now we're
actually using the Excel Viewer application, but it's klunky launching an
external application and then finding and embedding the window via API. We'd
much prefer using Excel itself via automation but we're finding what should
be a simple operation (setting the sheets to be read only) to be more
complex than we had anticipated. Unless I've missed something?


Hmmm, not easy! As you mentioned, there are lots of little gotchas to contend
with, such as sheets already protected, and what about third-party activeX
controls on the sheets, that might not respond to a Locked property?

I would be tempted to use an image control and a tab strip, with Excel
automated in the background (never visible). When you load a workbook, at tabs
to the tab strip for each (visible) sheet in the book; when a tab is clicked,
use Sheet.UsedRange.CopyPicture to copy an image of it to the clipboard, then
set the clipboard's image to the Image control. Whether you consider that to be
more or less of a 'hack' than using the actual Viewer is a matter of
preference!

Regards

Stephen Bullen
Microsoft MVP - Excel
www.oaltd.co.uk