View Single Post
 
Old 05-22-2016, 08:59 AM
dan88 dan88 is offline Windows 10 Office 2016
Novice
 
Join Date: Feb 2016
Posts: 24
dan88 is on a distinguished road
Default

Hi Graham,

with a little tweak, i have been able to get this to change the buttons on the Canvas.

It will set the actual button names in the properties.

Code:
Sub CanvasButtons()
'Graham Mayor - www.gmayor.com
Dim oFrm As New UserForm1
Dim Arr() As Variant
Dim oCtrl As Object
Dim i As Long


    Arr = xlFillArray(strWorkbook, strSheet)
    
    With ThisDocument.VBProject.vbComponents("UserForm1").Designer
      For i = 0 To UBound(Arr, 2)
            For Each oCtrl In .Controls

            If oCtrl.Name = Arr(3, i) Then
            oCtrl.Caption = Arr(4, i)
            oCtrl.Height = 100
            oCtrl.Width = 300
            oCtrl.BackColor = RGB(0, 127, 127)


            ElseIf oCtrl.Name = Arr(5, i) Then
            oCtrl.Caption = Arr(6, i)

           ' I may add lots more ElseIfs   :)

                End If
            Next oCtrl
        Next i

        '.Show
    End With
    
lbl_Exit:
    'Set oCtrl = Nothing
    Exit Sub
End Sub
Thanks Again!

Happy coding Sunday

dan

solved
Reply With Quote