Results 1 to 7 of 7

Thread: Speed of populating a Ribbon Bar

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Speed of populating a Ribbon Bar

    I'm using Word 2016 now and Windows 10.

    I have created a template for use in two different languages and written the XML and have used 'getLabel', ''getScreenTip' and 'getSuperTip' where appropriate in all the controls.

    All the labels are in an Excel file with all the control IDs in three separate named ranges to cater for the getLabel, getScreentip and getSupeTip.

    I have the following 'getLabel' procedure to label each of the controls in the XML. Everything works perfectly: the labels get called correctly and the Ribbon Bar gets loaded properly.

    Sub RDB_getLabel(control As IRibbonControl, ByRef returnVal)
    Dim wsht As Excel.Workbook
    Dim wksheet As Excel.Worksheet
    Dim inifileloc2 As String
    'Reads the location of the Office Details spreadsheet
    VarPathLocal = Options.DefaultFilePath(wdUserTemplatesPath)
    VarPathNetwork = Options.DefaultFilePath(wdWorkgroupTemplatesPath)
    FullPath = VarPathLocal + "\" + "Office Details.xls"
    FullPathNet = VarPathNetwork + "\" + "Office Details.xls"
    If Dir(FullPath) <> "" Then
    inifileloc2 = FullPath
    ElseIf Dir(FullPathNet) <> "" Then
    inifileloc2 = FullPathNet
    End If
    On Error Resume Next
    Set wsht = GetObject(inifileloc2)
    Set wksheet = wsht.Worksheets("Letterhead")
    returnVal = wsht.Application.VLookup(, wksheet.Range("rdbLabels"), 3, 0)
    If Err.Number > 0 Then
    returnVal = "Error"
    End If
    On Error GoTo 0
    End Sub
    The problem I'm getting is that the procedure to label all of the controls is taking 50 seconds before the Ribbon Bar appears! Yes, there are, in fact, 46 getLabel calls so one could say "What do you expect?".

    Could there be another way of achieving the same result, but getting the Ribbon to load that much faster, please?

    Some guidance would be much appreciated.
    Last edited by Bob Phillips; 09-11-2017 at 08:49 AM. Reason: Added code tags

Tags for this Thread

Posting Permissions

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