Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / July 2005

Tip: Looking for answers? Try searching our database.

Copy image from form to toolbar

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ulf Nilsson - 06 Jul 2005 15:11 GMT
Hi,
How can I copy a picture I use with a button in a form to a button on a
toolbar?

Background:
I use Office XP Dev to create dll and I don't want to use the built-in
faceID but use my own created pictures.

/ Ulf
Jean-Guy Marcil - 06 Jul 2005 16:10 GMT
Ulf Nilsson was telling us:
Ulf Nilsson nous racontait que :

> Hi,
> How can I copy a picture I use with a button in a form to a button on
[quoted text clipped - 3 lines]
> I use Office XP Dev to create dll and I don't want to use the built-in
> faceID but use my own created pictures.

A fast way would be to insert the picture in the Word Document, select it,
do CTRL-C, then access the toolbar button properties through the customize
menu, then, from right clicking on the button, do "Paste button image".
Unless you meant programmatically...

Signature

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org

Ulf Nilsson - 07 Jul 2005 06:39 GMT
Hi,
Yes, I do mean programmatically.

/ Ulf

> Ulf Nilsson was telling us:
> Ulf Nilsson nous racontait que :
[quoted text clipped - 11 lines]
> menu, then, from right clicking on the button, do "Paste button image".
> Unless you meant programmatically...
Jean-Guy Marcil - 07 Jul 2005 15:11 GMT
Ulf Nilsson was telling us:
Ulf Nilsson nous racontait que :

> Hi,
> Yes, I do mean programmatically.

Have you looked up the PasteFace method?

Signature

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org 

Jonathan West - 07 Jul 2005 17:05 GMT
> Hi,
> Yes, I do mean programmatically.

OK, there are two ways of putting a custom button with your own image onto a
toolbar.

1. You have a dummy toolbar which you keep invisible acting as a storage
place for all your custom buttons, and then use the Copy method of the
CommandBarControl object to copy it to some other (visible) toolbar.

2. You get your image into the clipboard and then use the PasteFace method
to apply it to the button.

I'm not aware of any other methods.

Signature

Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org 

Ulf Nilsson - 08 Jul 2005 06:57 GMT
Hi,

I want to create a toolbar using vba (because I do not know how to manually
add a toolbar with Office XP Developer in an dll). How do I add my own images
on the buttons? I know how to do it with dot-files and that way does not
apply with dll-files.

How do I copy an image from a button in a form to the clipboard?
Copy/PasteFace does only apply to CommandBarButton. My question is about
forms.

/ Ulf

> > Hi,
> > Yes, I do mean programmatically.
[quoted text clipped - 10 lines]
>
> I'm not aware of any other methods.
Jean-Guy Marcil - 08 Jul 2005 15:07 GMT
Ulf Nilsson was telling us:
Ulf Nilsson nous racontait que :

> Hi,
>
> I want to create a toolbar using vba (because I do not know how to
> manually add a toolbar with Office XP Developer in an dll). How do I
> add my own images on the buttons? I know how to do it with dot-files
> and that way does not apply with dll-files.

You need to et the bitmap in the clipboard. TO do that, you must have the
bitmap available somewhere. I do not think you can get it from an already
existing userform button. Once the userform is created, you cannot extract
the image from a control... well, at least I have never seen it done.

> How do I copy an image from a button in a form to the clipboard?
> Copy/PasteFace does only apply to CommandBarButton. My question is
> about forms.

and toolbars as stated in your subject line:  "Copy image from form to
toolbar"

I think you are going to have to use Jonathan's idea about keeping a toolbar
around as a source of button images.

> / Ulf
>
[quoted text clipped - 21 lines]
>> Keep your VBA code safe, sign the ClassicVB petition
>> www.classicvb.org

Signature

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org 

Ulf Nilsson - 12 Jul 2005 13:57 GMT
Hi Jean-Guy and Jonathan,

I almost gave up finding any solution to my problem, BUT have found the
following solution (in a two years old document). I think I did not explain
my problem in a understandable way for you.

'***On startup
Dim cbToolbarOffice As Office.CommandBar
Dim picUpdate As IPictureDisp

Set picUpdate = stdole.StdFunctions.LoadPicture("C:\Temp\Update.bmp")

Set cbToolbarOffice = appHostApp.CommandBars.Add(Name:="AV", _
       Position:=msoBarTop)

'***Buttons on the toolbar
   Set cmbUpdate = cbToolbarOffice.Controls.Add(Type:=msoControlButton, _
       Parameter:="AV_Toolbar")
   With cmbUpdate
       .Style = msoPicture
       .Caption = "&The List"
       .Picture = picUpdate
       .TooltipText = "Show the list"
   End With

Instead of "FaceId", I used "Picture" and it works.

Thanks both of you for your advice and patient.

/ Ulf

> Ulf Nilsson was telling us:
> Ulf Nilsson nous racontait que :
[quoted text clipped - 46 lines]
> >> Keep your VBA code safe, sign the ClassicVB petition
> >> www.classicvb.org
Ulf Nilsson - 12 Jul 2005 14:02 GMT
Hi Jean-Guy and Jonathan,

I almost gave up finding any solution to my problem, BUT have found the
following solution (in a two years old document). I think I did not explain
my problem in a understandable way for you.

'***On startup
Dim cbToolbarOffice As Office.CommandBar
Dim picUpdate As IPictureDisp

Set picUpdate = stdole.StdFunctions.LoadPicture("C:\Temp\Update.bmp")

Set cbToolbarOffice = appHostApp.CommandBars.Add(Name:="AV", _
       Position:=msoBarTop)

'***Buttons on the toolbar
   Set cmbUpdate = cbToolbarOffice.Controls.Add(Type:=msoControlButton, _
       Parameter:="AV_Toolbar")
   With cmbUpdate
       .Style = msoPicture
       .Caption = "&The List"
       .Picture = picUpdate
       .TooltipText = "Show the list"
   End With

Instead of "FaceId", I used "Picture" and it works.

Thanks both of you for your advice and patient.

/ Ulf

> > Hi,
> > Yes, I do mean programmatically.
[quoted text clipped - 10 lines]
>
> I'm not aware of any other methods.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.