Solved

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

Posted on 2003-12-01
9
517 Views
Last Modified: 2010-05-01
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
Comment
Question by:Dave Brett
  • 4
  • 3
  • 2
9 Comments
 
LVL 5

Expert Comment

by:rajaamirapu
Comment Utility
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
 
LVL 50

Author Comment

by:Dave Brett
Comment Utility
no link?
0
 
LVL 5

Assisted Solution

by:rajaamirapu
rajaamirapu earned 100 total points
Comment Utility
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
 
LVL 50

Author Comment

by:Dave Brett
Comment Utility
Hi,

I cant seem to load the ClipBoard from Excel

Cheers

Dave
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 17

Expert Comment

by:smozgur
Comment Utility
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
 
LVL 17

Accepted Solution

by:
smozgur earned 400 total points
Comment Utility
0
 
LVL 50

Author Comment

by:Dave Brett
Comment Utility
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
 
LVL 17

Expert Comment

by:smozgur
Comment Utility
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
 
LVL 50

Author Comment

by:Dave Brett
Comment Utility
Me too - the EE mail is arriving up to a day late
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now