Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 265
Default Chanagin buttons images

Hi, I made a custom toolbar, I want when a user clicks one button appears an
image (and a macro is executed), when he presses again (the same button)
appears another button image and another macro is executed and finally when
he presss it again (the same button), execut another macro and the first
button image appears. How Could I do this???
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default Chanagin buttons images

An easier way to set this up would be to create three different buttons (and
associated macros) and set them beside each other, then use the
CommandButton.Visible property to selectively make them appear and disappear;
to the user this would have the same functionality:

Sub MyButton1_Click()
' Put your code here
CommandBars("MyBar").CommandButtons("MyButton1").V isible = False
CommandBars("MyBar").CommandButtons("MyButton2").V isible = True
End Sub

Sub MyButton2_Click()
' Put your code here
CommandBars("MyBar").CommandButtons("MyButton2").V isible = False
CommandBars("MyBar").CommandButtons("MyButton3").V isible = True
End Sub

Sub MyButton3_Click()
' Put your code here
CommandBars("MyBar").CommandButtons("MyButton3").V isible = False
CommandBars("MyBar").CommandButtons("MyButton1").V isible = True
End Sub

"filo666" wrote:

Hi, I made a custom toolbar, I want when a user clicks one button appears an
image (and a macro is executed), when he presses again (the same button)
appears another button image and another macro is executed and finally when
he presss it again (the same button), execut another macro and the first
button image appears. How Could I do this???

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default Chanagin buttons images

Correction: instead of CommandButtons should have typed CommandBarButtons!

"K Dales" wrote:

An easier way to set this up would be to create three different buttons (and
associated macros) and set them beside each other, then use the
CommandButton.Visible property to selectively make them appear and disappear;
to the user this would have the same functionality:

Sub MyButton1_Click()
' Put your code here
CommandBars("MyBar").CommandButtons("MyButton1").V isible = False
CommandBars("MyBar").CommandButtons("MyButton2").V isible = True
End Sub

Sub MyButton2_Click()
' Put your code here
CommandBars("MyBar").CommandButtons("MyButton2").V isible = False
CommandBars("MyBar").CommandButtons("MyButton3").V isible = True
End Sub

Sub MyButton3_Click()
' Put your code here
CommandBars("MyBar").CommandButtons("MyButton3").V isible = False
CommandBars("MyBar").CommandButtons("MyButton1").V isible = True
End Sub

"filo666" wrote:

Hi, I made a custom toolbar, I want when a user clicks one button appears an
image (and a macro is executed), when he presses again (the same button)
appears another button image and another macro is executed and finally when
he presss it again (the same button), execut another macro and the first
button image appears. How Could I do this???

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 265
Default Chanagin buttons images

tanks¡¡¡¡¡¡¡ where could I learn how to use VB well??????????????

"K Dales" wrote:

An easier way to set this up would be to create three different buttons (and
associated macros) and set them beside each other, then use the
CommandButton.Visible property to selectively make them appear and disappear;
to the user this would have the same functionality:

Sub MyButton1_Click()
' Put your code here
CommandBars("MyBar").CommandButtons("MyButton1").V isible = False
CommandBars("MyBar").CommandButtons("MyButton2").V isible = True
End Sub

Sub MyButton2_Click()
' Put your code here
CommandBars("MyBar").CommandButtons("MyButton2").V isible = False
CommandBars("MyBar").CommandButtons("MyButton3").V isible = True
End Sub

Sub MyButton3_Click()
' Put your code here
CommandBars("MyBar").CommandButtons("MyButton3").V isible = False
CommandBars("MyBar").CommandButtons("MyButton1").V isible = True
End Sub

"filo666" wrote:

Hi, I made a custom toolbar, I want when a user clicks one button appears an
image (and a macro is executed), when he presses again (the same button)
appears another button image and another macro is executed and finally when
he presss it again (the same button), execut another macro and the first
button image appears. How Could I do this???

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Chanagin buttons images

Are you using built in images? Just change the FaceId property. Otherwise
you have to use the pasteface method.

--
Regards,
Tom Ogilvy


"filo666" wrote in message
...
Hi, I made a custom toolbar, I want when a user clicks one button appears

an
image (and a macro is executed), when he presses again (the same button)
appears another button image and another macro is executed and finally

when
he presss it again (the same button), execut another macro and the first
button image appears. How Could I do this???





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 265
Default Chanagin buttons images

pd. appears a strange error:
Compile error
method or data member not found

"K Dales" wrote:

An easier way to set this up would be to create three different buttons (and
associated macros) and set them beside each other, then use the
CommandButton.Visible property to selectively make them appear and disappear;
to the user this would have the same functionality:

Sub MyButton1_Click()
' Put your code here
CommandBars("MyBar").CommandButtons("MyButton1").V isible = False
CommandBars("MyBar").CommandButtons("MyButton2").V isible = True
End Sub

Sub MyButton2_Click()
' Put your code here
CommandBars("MyBar").CommandButtons("MyButton2").V isible = False
CommandBars("MyBar").CommandButtons("MyButton3").V isible = True
End Sub

Sub MyButton3_Click()
' Put your code here
CommandBars("MyBar").CommandButtons("MyButton3").V isible = False
CommandBars("MyBar").CommandButtons("MyButton1").V isible = True
End Sub

"filo666" wrote:

Hi, I made a custom toolbar, I want when a user clicks one button appears an
image (and a macro is executed), when he presses again (the same button)
appears another button image and another macro is executed and finally when
he presss it again (the same button), execut another macro and the first
button image appears. How Could I do this???

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 265
Default Chanagin buttons images

Tom, could you be more specific, ¡what is an d how to use FaceId, how could I
build my own images???
How does my code should loks like???
tks
"Tom Ogilvy" wrote:

Are you using built in images? Just change the FaceId property. Otherwise
you have to use the pasteface method.

--
Regards,
Tom Ogilvy


"filo666" wrote in message
...
Hi, I made a custom toolbar, I want when a user clicks one button appears

an
image (and a macro is executed), when he presses again (the same button)
appears another button image and another macro is executed and finally

when
he presss it again (the same button), execut another macro and the first
button image appears. How Could I do this???




  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Chanagin buttons images

Sounds like you don't know anything about programming commandbars. Perhaps
some basic material:

http://support.microsoft.com/default...02&Product=xlw
How to customize menus and menu bars in Excel

John Walkenbach has two utilities on this link to help you identify builtin
faceids:

http://j-walk.com/ss/excel/tips/commandbars.htm



here is an article about creating commandbars with code:
http://msdn.microsoft.com/library/techart/ofcmdbar.htm

http://support.microsoft.com/?id=159619
XL97: Sample Macros for Customizing Menus and Submenus

http://support.microsoft.com/?id=213550
XL2000: Sample Macros for Customizing Menus and Submenus

http://support.microsoft.com/default...b;en-us;166755
File Title: Customizing Menu Bars, Menus, and Menu Items in Microsoft(R)
Excel 97
File Name: WE1183.EXE
File Size: 58041 bytes
File Date: 06/20/97
Keywords: kbfile kbappnote
Description: This Application Note can help you learn techniques for writing
Visual Basic(R) for Applications code to customize menus in Microsoft Excel
97. This Application Note contains code examples that you can use with the
following elements: menu bars, menus, menu items, submenus, and shortcut
menus.

http://support.microsoft.com/?id=160293
ACC97: How to Dim Menu Items or Disable Toolbar Buttons in Visual Basic for
Applications

http://support.microsoft.com/?id=198464
ACC2000: How to Dim Menu Items or Disable Toolbar Buttons in VBA

http://support.microsoft.com/?id=158550
XL97: Problems Disabling and Enabling Shortcut Menus

http://support.microsoft.com/?id=213561
XL2000: Problems Disabling and Enabling Shortcut Menus

http://support.microsoft.com/?id=213563
XL2000: Cannot Make Changes to Some Shortcut Menus

http://support.microsoft.com/?id=158434
XL97: Cannot Make Changes to Some Shortcut Menus

http://support.microsoft.com/?id=213209
XL2000: Sample Macros that Customize and Control Shortcut Menus

http://support.microsoft.com/?id=162878
XL97: Sample Macros That Customize and Control Shortcut Menus

http://support.microsoft.com/?id=213757
XL2000: How to Turn off Shortcut Menus

http://support.microsoft.com/?id=161440
XL97: How to Disable Shortcut Menus

http://support.microsoft.com/?id=170563
OFF97: How to Prevent Customization of Menus and Toolbars
Sub DisableToolbarMenu()
CommandBars("Toolbar List").Enabled = False
End Sub



http://support.microsoft.com/?id=161926
XL97: How to Place a Checkmark Next to a Menu Item

http://support.microsoft.com/?id=213735
XL2000: How to Place a Check Mark Next to a Custom Menu Item

http://support.microsoft.com/default...63&Product=xlw
Sample Macro to Add Check Marks to Custom Menu Commands (xl5/95)

http://support.microsoft.com/?id=211543
XL2000: Cannot Modify or Delete Custom Menus


http://support.microsoft.com/?id=213563
XL2000: Cannot Make Changes to Some Shortcut Menus

http://support.microsoft.com/?id=213700
XL2000: Custom Toolbar Is Added Above Existing Toolbars

http://support.microsoft.com/?id=167382
XL97: How to Restore a Built-In Menu

http://support.microsoft.com/?id=213708
XL2000: How to Hide and Restore a Built-In Menu

http://msdn.microsoft.com/library/of...97/web/008.htm
MS Officer 97 Programmer's Guide
Chapter 8: Menus and Toolbars

=====================
http://support.microsoft.com/?id=241652
BUG: Changes Made to Excel CommandBars Through Automation Are Not Saved

This says it is fixed in SR1:

http://support.microsoft.com/?id=249066
XL2000: Changes Aren't Saved When Altering or Resetting Toolbars Using
Automation
=====================

http://support.microsoft.com/?id=159466
Q159466 - XL97: List of ID Numbers for Built-In Command Bar Controls

http://support.microsoft.com/?id=213552
Q213552 - XL2000: List of ID Numbers for Built-In CommandBar Controls

http://support.microsoft.com/?id=162814
Q162814 - XL97: Sample Macros to Return ID for a CommandBar Control

http://support.microsoft.com/?id=213211
Q213211 - XL2000: Sample Macros to Return ID for a CommandBar Control

--
Regards,
Tom Ogilvy




"filo666" wrote in message
...
Tom, could you be more specific, ¡what is an d how to use FaceId, how

could I
build my own images???
How does my code should loks like???
tks
"Tom Ogilvy" wrote:

Are you using built in images? Just change the FaceId property.

Otherwise
you have to use the pasteface method.

--
Regards,
Tom Ogilvy


"filo666" wrote in message
...
Hi, I made a custom toolbar, I want when a user clicks one button

appears
an
image (and a macro is executed), when he presses again (the same

button)
appears another button image and another macro is executed and finally

when
he presss it again (the same button), execut another macro and the

first
button image appears. How Could I do this???






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Chart.Export images are shrinking as I export more images Jared Charts and Charting in Excel 3 January 29th 08 03:23 AM
Form buttons vs. ActiveX Buttons GeorgeJ Excel Discussion (Misc queries) 3 August 11th 07 09:02 PM
have toggle buttons but everytime print preview buttons move TinSandhu Excel Discussion (Misc queries) 1 October 11th 06 02:57 PM
How to add images to custom toolbar buttons? RADO[_3_] Excel Programming 3 November 1st 03 05:07 PM
Control Buttons vs. Command Buttons Robert Gibson Excel Programming 1 October 13th 03 04:33 PM


All times are GMT +1. The time now is 02:59 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"