+ Reply to Thread
Results 1 to 11 of 11

User Form

  1. #1
    Registered User
    Join Date
    08-10-2006
    Posts
    58

    User Form

    Hi all,

    Jason helped me a little while ago to set up user forms. I have all the code written for it (I assume correctly). I can't figure out how to actually start up this form though. The form is called "frmSpecs". I am trying to start it through a command button (I've even tried assigning a macro through a clip art picture) using the following code:
    Please Login or Register  to view this content.
    Even if I remove the "Load" line, I still get a run time error 424 saying "object required." What am I doing wrong???

    Thanks for your help,

    Jeff

    EDIT: The tutorial I used is http://www.exceltip.com/st/Create_Us...Excel/629.html

  2. #2
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    Hi again, Jeff. When the run time error shows, can you debug? If so, what line is highlighted?

    Jason

  3. #3
    Registered User
    Join Date
    08-10-2006
    Posts
    58
    the Load line is highlighted when I click debug. If I delete this line, the frmSpecs.show line is highlighted, with no change of the error message. The name of the actual form (as it shows in the project explorer) is "frmSpecs" if that makes any difference. I've looked at other tutorials and searched google a bit with no success. Is it possible the computers I am using are missing an add in?

  4. #4
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    No, that shouldn't be the issue. Is it possible to upload a zipped copy of your workbook so I (or someone else) can check it out?

  5. #5
    Registered User
    Join Date
    08-10-2006
    Posts
    58
    I attached the spreadsheet. It will likely be something silly that I left out somewhere and just never found when I triple checked everything. Thanks for your help.
    Attached Files Attached Files

  6. #6
    Forum Contributor
    Join Date
    08-28-2006
    Posts
    280
    Redstang,

    The first thing I notice, until someone more knowledgeable comes along, is you have not named your textboxes and comboboxes properly in the properties window. If your text box is ProductName in the properties box it should be written as txtProductName, txtBottles, txtBottlesize, cboProduct, etc. Otherwise, excel can't find it-Hence your error.

    Dean

  7. #7
    Registered User
    Join Date
    08-10-2006
    Posts
    58
    Dean, I'm not sure I am following exactly what you are saying. I have named the text box itself ProductName in the properties window, and referred to it as txtProductName in the code itself. The labels I left named as Label1, 2, 3, etc. Do I need to change label names as well, or did I just completely misunderstand what you were trying to tell me?

    Thanks,
    Jeff

    To try to help clarify my issue here, in Debug mode, if you hover over frmSpecs, it says " frmSpecs = <Object variable or with block variable not set> "
    Last edited by redstang423; 04-01-2007 at 04:22 PM.

  8. #8
    Forum Contributor
    Join Date
    08-28-2006
    Posts
    280
    Redstang,

    When you labeled the textboxes and comboboxes in the Properties Window you did not include the "txt" preceeding the textbox names or the "cbo" preceeding the combobox names. Therefore, the boxes on the Userform have not been defined, properly. Sorry, I gotta run. Hopefully, this will be a little help and someone with more knowledge than I will be along to help you more.

    Dean

  9. #9
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    Hi, Jeff. Your problem is referencing to the objects in the user form. You need to reference it in the procedures just as you named it. So if you named the actual text box 'ProductName', you cannot refer to it in the procedures as 'txtProductName'. I would just rename your objects within the user form to agree with your coding.

    ... Looks like Dean beat me to it.

    HTH

    Jason

  10. #10
    Forum Contributor
    Join Date
    09-28-2006
    Posts
    122

    Bump

    I took a look at your code, it is always important to referance the userform objects in the code exactly as they are named in the properties window.

    removing the txt and cb referances from the start of the names works fine for me,

    looks like i got beaten to it too................

  11. #11
    Registered User
    Join Date
    08-10-2006
    Posts
    58

    Thanks!

    Dean, Jason, and PeeJay: Thank you for your help! That was the issue. I must've misinterpreted how the tutorial was telling me to code everything compared to naming it. Thanks again!

    Jeff

+ 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