• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 532
  • Last Modified:

Create customised control Face Id's and attach them to Excel control controls

Hi All,

I've written some simple code below to add some toolbar controls to a custom commandbar. I want to put custom built face iIs on the buttons and it sounds like this can be done by pasting the Face Id's from the Clipboard. But this is outside my Excel programming skill, how do I create, then acess custom button faceid's via the Clipboard?

Cheers

Dave

Public Const CB As String = "Colour Toolbar"

Sub NewToolbar()
Dim Ctrl       As CommandBarControl
Dim TB         As CommandBar
    On Error Resume Next
    Application.CommandBars(CB).Delete
    On Error GoTo 0
    Set TB = Application.CommandBars.Add(Name:=CB, Position:=msoBarTop)
    TB.Visible = True
        For i = 1 To 3
        Set Ctrl = TB.Controls.Add(Type:=msoControlButton)
        Ctrl.FaceId = 400 + i  'Random id's
        Ctrl.Caption = "Control " & i
    Next
End Sub
0
Dave Brett
Asked:
Dave Brett
  • 4
  • 3
  • 2
2 Solutions
 
rajaamirapuCommented:
Clipboard.SetData LoadPicture(App.Path & "\Help.bmp")
    Set cbSubCommandBar = cbMenuCommandBar.Controls.Add(1)
    cbSubCommandBar.Caption = "Help"
    cbSubCommandBar.PasteFace
Hope this helps
See the link
0
 
Dave BrettVice President - Business EvaluationAuthor Commented:
no link?
0
 
rajaamirapuCommented:
I missed the Link Using PasteFace you can do this
Ctrl.FaceId = 400 + i  'Random id's
Ctrl.Caption = "Control " & i
Clipboard.SetData LoadPicture(App.Path & "\Help.bmp")
cbSubCommandBar.PasteFace

0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
Dave BrettVice President - Business EvaluationAuthor Commented:
Hi,

I cant seem to load the ClipBoard from Excel

Cheers

Dave
0
 
Suat OzgurWeb / Application DeveloperCommented:
Yes, Dave. VBA doesn't have Clipboard object but VB.

Have you seen the second method ?

http://www.mvps.org/word/FAQs/MacrosVBA/SetCustomButtonImage.htm

Suat
0
 
Suat OzgurWeb / Application DeveloperCommented:
0
 
Dave BrettVice President - Business EvaluationAuthor Commented:
I cant believe I missed that link  - thanks Suat

Thanks to you as well rajaamirapu , I've given you some points for your effort

Cheers

Dave
0
 
Suat OzgurWeb / Application DeveloperCommented:
Great to hear it helps!!!

I think I have free access on VIP next month too!! If it is still 3000 points... LOL!! ;)

Suat
(Thanks for the grade, Dave)
(By the way, am I the only one who gets notification emails from EE very but VERY late. It was manual refresh this time to make sure.  I have been getting notifications TOMORROW!)
0
 
Dave BrettVice President - Business EvaluationAuthor Commented:
Me too - the EE mail is arriving up to a day late
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 4
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now