Results 1 to 2 of 2

Refreshing the ribbon interface before a call from a macro

Threaded View

  1. #1
    Registered User
    Join Date
    01-19-2021
    Location
    cocha,bolivia
    MS-Off Ver
    2016
    Posts
    1

    Refreshing the ribbon interface before a call from a macro

    When creating custom ribbons, at some points in the application I need to be able to enable and or disable the button commands.

    The problem is that I can't get the ribbon to refresh before of call macro main to enable the Pause Button

    Public MyRibbonUI As IRibbonUI
    Public EnabledButton1 As Boolean
    Public EnabledButton2 As Boolean
    Public run As Boolean
    Public pause As Boolean
    
    Public Sub OnMainLoad(ribbon As IRibbonUI)
        Set MyRibbonUI = ribbon
        run = False
        pause = False
        EnabledButton1 = True
        EnabledButton2 = False
    End Sub
    
    Public Sub Button_GetEnabled(control As IRibbonControl, ByRef Enabled)
        Select Case control.ID
            Case "Button1"
                Enabled = EnabledButton1
            Case "Button2"
                Enabled = EnabledButton2
        End Select
    End Sub
    
    Public Sub Run_OnAction(Button As IRibbonControl)
        EnabledButton1 = False
        EnabledButton2 = True
        MyRibbonUI.InvalidateControl ("Button1")
        MyRibbonUI.InvalidateControl ("Button2")
        'Refreshing the ribbon interface before of call Main
        If run = False And pause = False Then
            run = True
            Call Main
        ElseIf run = True And pause = True Then
            pause = False
        End If
    End Sub
    
    Sub Pause_OnAction(Button As IRibbonControl)
        pause = True
        EnabledButton1 = True
        EnabledButton2 = False
        MyRibbonUI.InvalidateControl ("Button1")
        MyRibbonUI.InvalidateControl ("Button2")
        'Refreshing the ribbon interface
    End Sub
    
    Public Sub Main()
        i = 1
        Do While run
            Cells(1, 1) = i
            i = i + 1
            DoEvents
            If pause Then
                Call Wait
            End If
        Loop
    End Sub
    
    Sub Wait()
        If pause Then
            Do
               DoEvents
            Loop Until Not pause
        End If
    End Sub
    Last edited by ElmerCC; 01-19-2021 at 11:12 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Call the value conain in an Edit Box in a personal Ribbon and use it in macro
    By cpmsimoes in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-13-2017, 12:37 PM
  2. Oracle Call Interface(OCI) C DLL function calls and void functions
    By Gregor y in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-15-2015, 01:31 PM
  3. Web Services function call and data refreshing
    By Jonathan Stone in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 03:05 AM
  4. Web Services function call and data refreshing
    By Jonathan Stone in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 02:05 AM
  5. [SOLVED] Web Services function call and data refreshing
    By Jonathan Stone in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 12:05 AM
  6. Web Services function call and data refreshing
    By Jonathan Stone in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 10:05 PM
  7. Web Services function call and data refreshing
    By Jonathan Stone in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 05-31-2005, 10:05 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1