Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default Option Buttons

Hi,
I have a workbook with a few VBA macros. Some of those macros are assigned
to a custom toolbar.
On that custom toolbar, I want to add a checkbox or option button, to
indicate a true/false state.
If true then checked image else unchecked image
I need this in some coditional programming in a macro, I will need to check
the state of the checkbox when the macro is executed.

Is this possible on a toolbar?

Thanks in advance
Habib


--
www.DynExtra.com
A resource for the Microsoft Dynamics Community
Featuring FAQs, File Exchange and more
Current member count: 40
--------------------------------------------
Share your knowledge. Add your favorite questions and answers
Help add questions to this site! We want Your input.
--------------------------------------------


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Option Buttons

This is an example of code that sets/unsets a checkmark when a menu is
clicked, It goes in the macro assigned to the menu item in OnAction.

With Application.CommandBars.ActionControl
If .State = msoButtonUp Then
ActiveWorkbook.Worksheets(.Caption).Visible = xlSheetHidden
.State = msoButtonDown
Else
ActiveWorkbook.Worksheets(.Caption).Visible = xlSheetVisible
.State = msoButtonUp
End If
End With

Set it initially like so

Set octl = CommandBars("Worksheet Menu Bar").Controls("Tools").Controls("My
Test")
oCtl.State = msoButtonDown


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"HSalim[MVP]" wrote in message
...
Hi,
I have a workbook with a few VBA macros. Some of those macros are

assigned
to a custom toolbar.
On that custom toolbar, I want to add a checkbox or option button, to
indicate a true/false state.
If true then checked image else unchecked image
I need this in some coditional programming in a macro, I will need to

check
the state of the checkbox when the macro is executed.

Is this possible on a toolbar?

Thanks in advance
Habib


--
www.DynExtra.com
A resource for the Microsoft Dynamics Community
Featuring FAQs, File Exchange and more
Current member count: 40
--------------------------------------------
Share your knowledge. Add your favorite questions and answers
Help add questions to this site! We want Your input.
--------------------------------------------




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default Option Buttons

Bob
Thanks for the quick reply.
I'm not using menus - that is an option I could consider
Is there a way to do this using just toolbars?

From what I have been reading, I think I'll have to reset the toolbar button
face image.
I know that these are special image files, so I guess I have some more
digging to do...
Regards
HS

--
www.DynExtra.com
A resource for the Microsoft Dynamics Community
Featuring FAQs, File Exchange and more
Current member count: 40
--------------------------------------------
Share your knowledge. Add your favorite questions and answers
Help add questions to this site! We want Your input.
--------------------------------------------
"Bob Phillips" wrote in message
...
This is an example of code that sets/unsets a checkmark when a menu is
clicked, It goes in the macro assigned to the menu item in OnAction.

With Application.CommandBars.ActionControl
If .State = msoButtonUp Then
ActiveWorkbook.Worksheets(.Caption).Visible = xlSheetHidden
.State = msoButtonDown
Else
ActiveWorkbook.Worksheets(.Caption).Visible = xlSheetVisible
.State = msoButtonUp
End If
End With

Set it initially like so

Set octl = CommandBars("Worksheet Menu
Bar").Controls("Tools").Controls("My
Test")
oCtl.State = msoButtonDown


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"HSalim[MVP]" wrote in message
...
Hi,
I have a workbook with a few VBA macros. Some of those macros are

assigned
to a custom toolbar.
On that custom toolbar, I want to add a checkbox or option button, to
indicate a true/false state.
If true then checked image else unchecked image
I need this in some coditional programming in a macro, I will need to

check
the state of the checkbox when the macro is executed.

Is this possible on a toolbar?

Thanks in advance
Habib


--
www.DynExtra.com
A resource for the Microsoft Dynamics Community
Featuring FAQs, File Exchange and more
Current member count: 40
--------------------------------------------
Share your knowledge. Add your favorite questions and answers
Help add questions to this site! We want Your input.
--------------------------------------------






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 380
Default Option Buttons

No, on toolbars setting the state property makes it looked raised or not.

You could try something like this, that creates a pseudo-checkmark

Sub BuildMenu()

With Application.CommandBars.Add(Name:="Test", temporary:=True)

With .Controls.Add(Type:=msoControlButton)
.Caption = "check"
.Style = msoButtonIcon
.Tag = "checked"
.FaceId = 1087
.OnAction = "checkMe"
End With

With .Controls.Add(Type:=msoControlButton)
.Caption = "myMacro"
.Style = msoButtonCaption
.FaceId = 1087
.OnAction = "myMacro"
End With

.Visible = True

End With

End Sub

Sub checkme()

With Application.CommandBars.ActionControl

If .Tag = "checked" Then
.Tag = "unchecked"
.FaceId = 1091
Else
.Tag = "checked"
.FaceId = 1087
End If

End With

End Sub

Sub myMacro()

MsgBox Application.CommandBars("Test").Controls("check"). Tag
End Sub



--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)

"HSalim[MVP]" wrote in message
...
Bob
Thanks for the quick reply.
I'm not using menus - that is an option I could consider
Is there a way to do this using just toolbars?

From what I have been reading, I think I'll have to reset the toolbar

button
face image.
I know that these are special image files, so I guess I have some more
digging to do...
Regards
HS

--
www.DynExtra.com
A resource for the Microsoft Dynamics Community
Featuring FAQs, File Exchange and more
Current member count: 40
--------------------------------------------
Share your knowledge. Add your favorite questions and answers
Help add questions to this site! We want Your input.
--------------------------------------------




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default Option Buttons

Thanks Bob!
Exactly what i needed.
regards
Habib


--
www.DynExtra.com
A resource for the Microsoft Dynamics Community
Featuring FAQs, File Exchange and more
Current member count: 40
--------------------------------------------
Share your knowledge. Add your favorite questions and answers
Help add questions to this site! We want Your input.
--------------------------------------------
"Bob Phillips" wrote in message
...
No, on toolbars setting the state property makes it looked raised or not.

You could try something like this, that creates a pseudo-checkmark

Sub BuildMenu()

With Application.CommandBars.Add(Name:="Test", temporary:=True)

With .Controls.Add(Type:=msoControlButton)
.Caption = "check"
.Style = msoButtonIcon
.Tag = "checked"
.FaceId = 1087
.OnAction = "checkMe"
End With

With .Controls.Add(Type:=msoControlButton)
.Caption = "myMacro"
.Style = msoButtonCaption
.FaceId = 1087
.OnAction = "myMacro"
End With

.Visible = True

End With

End Sub

Sub checkme()

With Application.CommandBars.ActionControl

If .Tag = "checked" Then
.Tag = "unchecked"
.FaceId = 1091
Else
.Tag = "checked"
.FaceId = 1087
End If

End With

End Sub

Sub myMacro()

MsgBox Application.CommandBars("Test").Controls("check"). Tag
End Sub



--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)

"HSalim[MVP]" wrote in message
...
Bob
Thanks for the quick reply.
I'm not using menus - that is an option I could consider
Is there a way to do this using just toolbars?

From what I have been reading, I think I'll have to reset the toolbar

button
face image.
I know that these are special image files, so I guess I have some more
digging to do...
Regards
HS

--
www.DynExtra.com
A resource for the Microsoft Dynamics Community
Featuring FAQs, File Exchange and more
Current member count: 40
--------------------------------------------
Share your knowledge. Add your favorite questions and answers
Help add questions to this site! We want Your input.
--------------------------------------------








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Option Buttons

Habib,

What exactly are Dynamics?

Bob


"HSalim[MVP]" wrote in message
...
Thanks Bob!
Exactly what i needed.
regards
Habib


--
www.DynExtra.com
A resource for the Microsoft Dynamics Community
Featuring FAQs, File Exchange and more
Current member count: 40
--------------------------------------------
Share your knowledge. Add your favorite questions and answers
Help add questions to this site! We want Your input.
--------------------------------------------



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default Option Buttons

Hi Bob,
Dynamics is the business management software line, comprising of 4 ERP or
accounting software packages and CRM - Dynamics AX/NAV/GP/SL/CRM
formerly known as Axapta, Navision, Great Plains and Solomon and Microsoft
CRM
Also included are Small Business Financials, RMS for Retail Management
Systems or Point of sale (cash registers etc)

The 4 ERP systems were acquisitions and are converging to a common codebase
at some point in the future. MS is putting a lot of effort into growing
this side of the business.

HS


--
www.DynExtra.com
A resource for the Microsoft Dynamics Community
Featuring FAQs, File Exchange and more
Current member count: 40
--------------------------------------------
Share your knowledge. Add your favorite questions and answers
Help add questions to this site! We want Your input.
--------------------------------------------
"Bob Phillips" wrote in message
...
Habib,

What exactly are Dynamics?

Bob


"HSalim[MVP]" wrote in message
...
Thanks Bob!
Exactly what i needed.
regards
Habib


--
www.DynExtra.com
A resource for the Microsoft Dynamics Community
Featuring FAQs, File Exchange and more
Current member count: 40
--------------------------------------------
Share your knowledge. Add your favorite questions and answers
Help add questions to this site! We want Your input.
--------------------------------------------





  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Option Buttons

Thanks Habib. Must look a little deeper.

Bob

"HSalim[MVP]" wrote in message
...
Hi Bob,
Dynamics is the business management software line, comprising of 4 ERP or
accounting software packages and CRM - Dynamics AX/NAV/GP/SL/CRM
formerly known as Axapta, Navision, Great Plains and Solomon and Microsoft
CRM
Also included are Small Business Financials, RMS for Retail Management
Systems or Point of sale (cash registers etc)

The 4 ERP systems were acquisitions and are converging to a common

codebase
at some point in the future. MS is putting a lot of effort into growing
this side of the business.

HS


--
www.DynExtra.com
A resource for the Microsoft Dynamics Community
Featuring FAQs, File Exchange and more
Current member count: 40
--------------------------------------------
Share your knowledge. Add your favorite questions and answers
Help add questions to this site! We want Your input.
--------------------------------------------
"Bob Phillips" wrote in message
...
Habib,

What exactly are Dynamics?

Bob


"HSalim[MVP]" wrote in message
...
Thanks Bob!
Exactly what i needed.
regards
Habib


--
www.DynExtra.com
A resource for the Microsoft Dynamics Community
Featuring FAQs, File Exchange and more
Current member count: 40
--------------------------------------------
Share your knowledge. Add your favorite questions and answers
Help add questions to this site! We want Your input.
--------------------------------------------







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
Option Buttons/Radio Buttons John Calder New Users to Excel 7 May 16th 08 03:51 AM
Option buttons: How to get the selected option from a group? naddad Excel Programming 5 December 21st 05 05:09 PM
Navigating between option buttons is not selecting the option drhalter Excel Programming 1 June 3rd 05 02:28 PM
Navigating between option buttons is not selecting the option Gixxer_J_97[_2_] Excel Programming 4 June 2nd 05 02:50 PM
yes/no option buttons Evanya Excel Discussion (Misc queries) 4 May 28th 05 12:19 AM


All times are GMT +1. The time now is 01:48 AM.

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

About Us

"It's about Microsoft Excel"