Home     Products      Support      Corporate     Sign In 
Support Knowledge Base, Article 1024
Product
ExcelWriter
Version
5.x
Title
Additional sheet is selected when Chartsheet is the active sheet
Problem

When a Chartsheet is the active sheet in an existing Workbook, after saving the file with the ExcelApplication object an additional sheet is also selected as an active sheet.

Solution

This issue applies to the COM version of the ExcelApplication object as well as the .NET wrapper class (SAExcelApplicationDotNet). ExcelWriter COM automatically selects the first Worksheet in a Workbook when saving if it detects that there are no sheets currently selected in the file. However, this detection is not always accurate. ExcelWriter COM will preserve Chartsheets, but cannot tell whether one is selected. When determining whether any sheets are selected, it only looks at Worksheets, not Chartsheets. Therefore, if a Chartsheet is selected but no Worksheets are, ExcelWriter thinks there are no sheets selected and will select the first Worksheet.

A workaround for this issue is to use VBA macro code in the Excel Workbook to select the desired Chartsheet, which will cause all other Worksheets and Chartsheets to be deselected. For example, to select the first Chartsheet and deselect all other sheets:

Private Sub Workbook_Open()

    Dim chart1 As Chart
    Set chart1 = ActiveWorkbook.Charts(1)
    chart1.Select

End Sub

This is not an issue with ExcelWriter .NET or Java, which both have full Chartsheet support.

Related Links
OfficeWriter Home Page
OfficeWriter Enterprise Edition
Latest OfficeWriter News
OfficeWriter: Programmatic Runtime Control

Created : 10/11/2005 3:54:09 PM (last modified : 10/11/2005 3:54:08 PM)
Rate this article!
 
Comments