Hi Guys!!
I am creating an addin in Excel using VB.Net.
I want to access the current worksheet using a ribbon designer.
I have tried all sorts but to no avail. Also all the resources that I have checked are
providing solutions by adding or opening new workbook.
What I want is to create a reference to the active worksheet.
For example by adding what we get is
Imports Microsoft.Office.Tools.Ribbon
Imports Microsoft.Office.Interop
Imports System.Windows.Forms
Dim currApp As Excel.Application
Dim curSheet As Excel.Worksheet
Dim curSheets As Excel.Sheets
Dim curBook As Excel.Workbook
Dim curBooks As Excel.Workbooks
Private Sub Ribbon1_Load(ByVal sender As Object, ByVal e As Microsoft.Office.Tools.Ribbon.RibbonUIEventArgs) Handles Me.Load
Try
currApp = New Excel.Application
curBooks = currApp.Workbooks
curBook = curBooks.Add
curSheets = curBook.Worksheets
curSheet = curSheets(1)
curSheet.Activate()
MsgBox(curSheet.Name)
Catch ex As Exception
MsgBox(ex.Message & vbCrLf & vbCrLf & ex.ToString)
End Try
End Sub
Give me some clue as how to start, Again I want to reference to currently active sheet