Solved

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

Posted on 2003-12-01
9
521 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
ID: 9855680
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
ID: 9855871
no link?
0
 
LVL 5

Assisted Solution

by:rajaamirapu
rajaamirapu earned 100 total points
ID: 9855921
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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 50

Author Comment

by:Dave Brett
ID: 9862500
Hi,

I cant seem to load the ClipBoard from Excel

Cheers

Dave
0
 
LVL 17

Expert Comment

by:Suat Ozgur
ID: 9862771
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:
Suat Ozgur earned 400 total points
ID: 9862793
0
 
LVL 50

Author Comment

by:Dave Brett
ID: 9862836
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:Suat Ozgur
ID: 9862963
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
ID: 9863129
Me too - the EE mail is arriving up to a day late
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
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 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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

829 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