We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Initial Selected Sheet Name on Spreadsheet Open

I've loaded and Excel spreadsheet into the spreadsheet file and want to know the name of the worksheet which is initially selected.

Using ManifestSpreadsheet.ActiveSheet.Name works but not upon the initial load when it shows as "Sheet1" although non of the worksheets is called sheet1.

I have determined the Excel file is loaded prior to attempting to read the name.



1 Reply

AA Arulraj A Syncfusion Team February 15, 2019 08:36 AM UTC

Hi Spotty, 

Thanks for using Syncfusion product. 

By initially empty spreadsheet has loaded. So, you may get the ActiveSheet.Name as “Sheet1”.  To get the active sheet name you could use the ActiveSheet.Name property in WorkBookLoaded event which should be triggered in  Form.Load event. Please refer the following code example and the sample. 

VB 
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load 
    AddHandler Me.Spreadsheet1.WorkbookLoaded, AddressOf Spreadsheet1_WorkBookLoaded 
    Spreadsheet1.Open("..\..\Spread1.xlsx") 
End Sub 
 
Private Sub Spreadsheet1_WorkBookLoaded(sender As Object, args As WorkbookLoadedEventArgs) 
    Dim name = Spreadsheet1.ActiveSheet.Name 
End Sub 


Arulraj A 


Loader.
Live Chat Icon For mobile
Up arrow icon