Results 1 to 3 of 3

Thread: Interaction with custom toolbar

  1. #1

    Thread Starter
    PowerPoster Radjesh Klauke's Avatar
    Join Date
    Dec 2005
    Location
    Sexbierum (Netherlands)
    Posts
    2,244

    Interaction with custom toolbar

    Hi,

    I have created a custom toolbar with a combobox which lists all sheets on startup. When I add or remove sheets using the standard excel actions they aren't listed/removed from the combobox. This is obvious of course, but how do I let my toolbar know that something has changed in the current workbook?

    I hope you understand what I'm trying to say.

    Thanks for the help in advance.


    If you found my post helpful, please rate it.

    Codebank Submission: FireFox Browser (Gecko) in VB.NET, Load files, (sub)folders treeview with Windows icons

  2. #2
    PowerPoster
    Join Date
    Oct 2008
    Location
    Midwest Region, United States
    Posts
    3,574

    Re: Interaction with custom toolbar

    Maybe you could count the number of sheets when the workbook is opened (with a global variable, save # for later use), then count again when a sheet is activated to see if was activated due to adding or deleting a sheet. Something like this:

    Code:
    Dim intSheets As Integer
    
    Private Sub Workbook_Open()
        intSheets = Worksheets.Count
    End Sub
    
    Private Sub Workbook_SheetActivate(ByVal Sh As Object)
        Dim intTempCount As Integer
        
        intTempCount = intSheets
        intSheets = Worksheets.Count
        
        If intTempCount <> intSheets Then
            MsgBox "A sheet has been added or deleted"
        End If
    End Sub

  3. #3

    Thread Starter
    PowerPoster Radjesh Klauke's Avatar
    Join Date
    Dec 2005
    Location
    Sexbierum (Netherlands)
    Posts
    2,244

    Re: Interaction with custom toolbar

    Thanks for the feedback. Unfortunately I can't use the Workbook_Open, 'cause the toolbar is Workbook-independend. Perhaps I'm missing something, but I don't see it.


    If you found my post helpful, please rate it.

    Codebank Submission: FireFox Browser (Gecko) in VB.NET, Load files, (sub)folders treeview with Windows icons

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width