+ Reply to Thread
Results 1 to 4 of 4

Unable to get code to run a click event on workbook open

  1. #1
    Registered User
    Join Date
    11-03-2012
    Location
    yorkshire, England
    MS-Off Ver
    Excel 2003
    Posts
    2

    Smile Unable to get code to run a click event on workbook open

    Hi everybody,
    I am trying to write a workbook_open macro that runs a command button event. I have seen a couple of solutions on this forum but still seem to be having problems.

    Code is:-

    Please Login or Register  to view this content.
    And error message says

    Run-time error '424'
    Object Required

    Is it because the command button is imbedded in sheet 1?
    By the way I am using Excel 2003

    Thank you in advance for any assistance
    Last edited by vlady; 11-05-2012 at 10:04 PM. Reason: code tags

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Unable to get code to run a click event on workbook open

    That code would only work with an ActiveX command button.

  3. #3
    Registered User
    Join Date
    11-03-2012
    Location
    yorkshire, England
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Unable to get code to run a click event on workbook open

    Ok thanks for that perhaps I should look at this another way, the code I want to run when the workbook is open is:-
    cmdNamesCombo.Clear

    Please Login or Register  to view this content.
    This populates a dropdown list in a combo box with all the range names on the sheet.
    Unfortunately when you exit the workbook & go back in the list is empty which is why I used the code within a control button to repopulate, but it would be nice to do this automatically or even stop the list from disappearing.
    I tried it in an active x control button but it returns a run time error 424 of "object required" am I missing something simple.
    Last edited by vlady; 11-05-2012 at 10:05 PM.

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Unable to get code to run a click event on workbook open

    Where is that located and what type of combobox is it?

    How about putting it in the Activate event of the worksheet the combobox is on?

    The code below works if cmdNamesCombo is an ActiveX combobox.
    Please Login or Register  to view this content.
    This code will work with a Forms dropdown.
    Please Login or Register  to view this content.

+ Reply to Thread

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