Results 1 to 7 of 7

Pass Commandbar.Control.caption to sub routine

Threaded View

Macdave_19 Pass... 07-01-2010, 10:19 AM
romperstomper Re: Pass... 07-01-2010, 10:41 AM
Andy Pope Re: Pass... 07-01-2010, 10:42 AM
Macdave_19 Re: Pass... 07-01-2010, 10:47 AM
romperstomper Re: Pass... 07-01-2010, 10:48 AM
Macdave_19 Re: Pass... 07-01-2010, 10:49 AM
Macdave_19 Re: Pass... 07-01-2010, 10:51 AM
  1. #1
    Valued Forum Contributor Macdave_19's Avatar
    Join Date
    03-14-2007
    Location
    Birmingham, England
    MS-Off Ver
    12.0
    Posts
    808

    Question Pass Commandbar.Control.caption to sub routine

    Hi All,

    I have a custom Commandbar addin with lots of my own macros built in.

    I'm trying to pass a value to a routine and then action it but i can't sus it out.

    here's the commandbar code (this works fine, but i would love to know how to pass the caption of the selected button instead of having to type "vbUpperCase")

    Set ctlSub2 = Ctl.Controls.Add(msoControlButton, , , , True)
                             With ctlSub2
                               .Caption = "vbUpperCase"
                               .OnAction = "CaseTool " & """" & "vbUpperCase" & """"
                               .Style = msoButtonCaption
                            End With
    So basically when i click on the "vbUppercase" button it runs the following (but doesn't work )


    Public Sub CaseTool(StrConv As String)
        Dim Cell As Range
        
        For Each Cell In Selection
            Cell.Value = StrConv(Cell.Value, StrConv)
        Next Cell
    End Sub
    any help is really appreciated

    thanks for taking the time to read it
    Last edited by Macdave_19; 07-01-2010 at 10:50 AM.
    Mr MaGoo
    Magoo.Inc MMVII

    If i've helped please add to my Rep by Clicking on the Blue Scales in the top right hand corner of the post

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1