+ Reply to Thread
Results 1 to 4 of 4

Workbook_Open() and Object Not Found

  1. #1
    Registered User
    Join Date
    06-29-2006
    Posts
    28

    Workbook_Open() and Object Not Found

    Hi,

    I am using the Workbook_Open() to open a form that I've built in VBA. The Sub is very simple:

    Please Login or Register  to view this content.
    The only problem is when running this I get the
    Run-time error '424'

    Object required
    And it centers on the sub. I am assuming the problem has to do with the fact I haven't properly declared or instaniated the object/Form printerSettingsForm.

    I tried goggling, but I couldn't find the proper technique to declare an object. So I was wondering how I could fix this problem?

  2. #2
    Tim Marsh
    Guest

    Re: Workbook_Open() and Object Not Found

    hi,

    try including the following line before the .show line

    load printerSettingsForm

    hth

    tim

    "FCC" <[email protected]> wrote in message
    news:[email protected]...
    >
    > Hi,
    >
    > I am using the Workbook_Open() to open a form that I've built in VBA.
    > The Sub is very simple:
    >
    >
    > Code:
    > --------------------
    >
    > Private Sub Workbook_Open()
    > printerSettingsForm.Show
    > End Sub
    >
    > --------------------
    >
    >
    > The only problem is when running this I get the
    >>
    >> Run-time error '424'
    >>
    >> Object required
    >>

    > And it centers on the sub. I am assuming the problem has to do with
    > the fact I haven't properly declared or instaniated the object/Form
    > printerSettingsForm.
    >
    > I tried goggling, but I couldn't find the proper technique to declare
    > an object. So I was wondering how I could fix this problem?
    >
    >
    > --
    > FCC
    > ------------------------------------------------------------------------
    > FCC's Profile:
    > http://www.excelforum.com/member.php...o&userid=35888
    > View this thread: http://www.excelforum.com/showthread...hreadid=558279
    >




  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259
    Hello FCC,

    Since you are opening the workbook, Excel doesn't know the user form is an object in the workbook. Try this method...

    With ThisWorkbook
    Load .PrinterSettingsForm
    .PrinterSetttingsForm.Show
    End With

    Sincerely,
    Leith Ross

  4. #4
    Registered User
    Join Date
    06-29-2006
    Posts
    28
    It's funny. I changed the name of my form to userForm and everything worked fine after that.

    It's like Excel doesn't recognize any form objects not named userForm unless you declare them using the Load button.

+ 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