Results 1 to 4 of 4
  1. #1
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Custom From buttons (2002, XP Pro SR2)

    Hi,

    Have a look at this article:

    http://www.jkp-ads.com/Articles/ControlHandler00.htm

    It is about handling events for option buttons on a worksheet, but the method is similar for buttons on a form. Put the code that ties the buttons to the class module inside the code module of the form and make sure it is run at form initialisation.
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

  2. #2
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: Custom From buttons (2002, XP Pro SR2)

    In addition to Jan's reference, check out Determine which text box(shape) called macro (97 ). There is a reference to a John Walkenbach example and some other code, in case you would like additional examples.

    Steve

  3. #3
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Perth, Western Australia, Australia
    Posts
    190
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Custom From buttons (2002, XP Pro SR2)

    Jan Karel & Steve,

    Thank you very much of the pointers, they are very helpful & appropriate.
    I will let you know how it goes...

  4. #4
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Perth, Western Australia, Australia
    Posts
    190
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Custom Form buttons (2002, XP Pro SR2)

    Gday all,

    I am still playing around with a little app to solve Suoku puzzles.
    I have a problem however - the interface.

    I think I will need a form that contains about 810 buttons! (9 buttons x 9buttons, each button overlaying another grid of 9 buttons)

    This is possible with a lot of patience to set it up manually, but that is not in my personality. Especially as each button would need click event coding.

    I have already proved that I can programatically create buttons on a form where I need them, however the event coding for each button has me stumped.

    <code>
    Sub CreateTextButtons()
    Dim i As Integer
    Dim j As Integer
    For i = 1 To 3
    For j = 1 To 3
    With Sudoku.Controls.Add("Forms.CommandButton.1", (i & j), True)
    .Top = 14 * i + 12
    .Left = 14 * j
    .Width = 14
    .Height = 14
    .Caption = i * j
    .FontSize = 6
    .FontName = "Verdana"
    End With
    Next j
    Next i

    End Sub</code>


    I was wondering if there was a way to define a class of button that I can dynamically place on a form, but when any of these buttons are clicked will call the SAME event handling procedure. I will then use this one procedure to capture the button name (or other unique identifier) to drive subsequent processing.

    Any ideas

Posting Permissions

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