PC Review


Reply
Thread Tools Rate Thread

checkBox & ListBox on ToolBar...

 
 
Johan2000
Guest
Posts: n/a
 
      23rd Mar 2008
Is that possible to have an checkBox and/or ListBox on
the toolbar.... so the code bellow will be run if checkBox is check, and
listBox
pointing to currency...

Thank You

/ How to modify the content of the current Cell in Excel
// put this code in Excel/VisualBasic/MsProject/ExCellObject/Worksheet1
Private Sub Worksheet_Change(ByVal Target As Range)
Dim x As String
x = Target.Value
If Right(x, 1) = "*" Then
Target.Value = Replace(x, "*", "000")
End If
End Sub
 
Reply With Quote
 
 
 
 
Patrick Molloy
Guest
Posts: n/a
 
      24th Mar 2008
this needs tweaking, but is enough to get you started:

Option Explicit
Global drpdwn As CommandBarComboBox

Sub SetMenuBar()
Dim newbar As CommandBar
Dim cntrl As CommandBarButton
If BarExists Then
CommandBars("Patrick").Delete
End If
Set newbar = CommandBars.Add("Patrick", msoBarFloating)
Set drpdwn = newbar.Controls.Add(msoControlComboBox)
With drpdwn
.Caption = "Currency"
.AddItem "USD"
.AddItem "EUR"
.AddItem "JPY"
End With
Set cntrl = newbar.Controls.Add(msoControlButton)
With cntrl
.Caption = "Run FX"
.OnAction = "RunFX"
End With
newbar.Visible = True
End Sub
Function BarExists() As Boolean
On Error Resume Next
Dim cb As CommandBar
Set cb = CommandBars("Patrick")
BarExists = Err.Number = 0
On Error GoTo 0
End Function
Sub RunFX()
Dim ccy As String
' YOUR CODE HERE
If drpdwn Is Nothing Then SetMenuBar
If drpdwn.Text = "" Then
ccy = "*"
Else
ccy = drpdwn.Text
End If
End Sub


"Johan2000" wrote:

> Is that possible to have an checkBox and/or ListBox on
> the toolbar.... so the code bellow will be run if checkBox is check, and
> listBox
> pointing to currency...
>
> Thank You
>
> / How to modify the content of the current Cell in Excel
> // put this code in Excel/VisualBasic/MsProject/ExCellObject/Worksheet1
> Private Sub Worksheet_Change(ByVal Target As Range)
> Dim x As String
> x = Target.Value
> If Right(x, 1) = "*" Then
> Target.Value = Replace(x, "*", "000")
> End If
> End Sub

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
ListBox Checkbox DS Microsoft Access Form Coding 1 28th Nov 2005 06:25 PM
VBA: Creating listbox similar to the one in Pivot table (Listbox+Checkbox) modjoe23 Microsoft Excel Programming 3 18th Aug 2005 02:35 PM
Listbox and checkbox =?Utf-8?B?VGlt?= Microsoft Access Getting Started 0 20th Jun 2005 11:48 PM
Checkbox in a Listbox? DannyBoy Microsoft Access Forms 4 6th Jan 2004 10:42 PM
Checkbox in ListBox Edmilson Microsoft ASP .NET 2 27th Jun 2003 06:21 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:06 PM.