Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


UserForm1.Show gives an error...

UserForm1.Show gives an error...

UserForm1.Show gives an error...

Okay, here's the setup: I've got an .XLS file storing a set of macros (modules) and a single userform (called UserForm1). Now, I'm invoking the macros from another worksheet that I opened in Excel and I'm trying to load the userform that I created:

Sub ShowMyForm()
End Sub

but everytime I try, I get the same error:

Run-time error '424'
   Object Required

Can someone help me out here? I'm getting annoied with this thing.

RE: UserForm1.Show gives an error...

Simply using UserForm1 means 'UserForm1 in the ActiveWorkbook -

Since u're invoking this from another workbook - which does NOT contain UserForm1 - u get the error msg.

See the VBA help & then try making the proper reference to UserForm1 - and PLEASE don't do yourself the disservice of getting annoyed - the thing'll elude you more...

Good luck!

RE: UserForm1.Show gives an error...

Mala is correct. One solution to your problem may be as follows:
Place the following code in the module of any workbook (other than one named Book1.xls):

Sub ShowMyForm()
    Application.Run ("Book1!ShowForm")
End Sub

Then place the following code into a different workbook in this case called Book1.xls which contains the Form UserForm1:

Sub ShowForm()
End Sub

I hope this solution is adequate for you. Of course if the workbook invoked by the ShowMyForm() macro is not open (in this case Book1.xls) or if it does not contain a macro called ShowForm() you will still get a 424 error.

RE: UserForm1.Show gives an error...

Good, cryoguy!

Inclusion of the following code would do the needful (and avoid the error msg) if the file is not open:

Sub CheckOpen()
    BookName = "C:\MyDocuments\ShowFormBook.xls"
    For Each Bk In Workbooks
        If Bk.FullName = BookName Then Exit Sub
    Workbooks.Open FileName:=BookName
End Sub

This sub can be entered into you suggested sub or referred to as:

Sub ShowMyForm()
    Application.Run ("Book1!ShowForm")
End Sub

RE: UserForm1.Show gives an error...

PS Correct the name of the UserForm workbook in either of the two procedures - it should be one of (of course, you'll actually use the name YOU have given to the file):

'ShowFormBook' or 'Book1' in BOTH procedures

RE: UserForm1.Show gives an error...

Well, actually I'd thought of that. The only problem is that adding modules to the referencing workbook isn't an option.

Users are supposed to be able to download "sterile" data in a .CSV format (clean of any modules/forms/add-ins) and run the macros I created to generate their charts. What I wanted to do was create a user interface that would allow them to specify the ranges of the data (they won't always want ALL the data in the file), type of chart, etc.

The purpose is to make things more convenient for the users (who will probably have next to no experience with Excel) so they won't have to select the data manually and go through the process of creating the chart. Yeah, I know, lazy bums...

RE: UserForm1.Show gives an error...

In this case the procedure would be to import the data from a user-specified CSV in Excel and THEN process it. It shouldn't be very difficult to write code for this...

If you could send a sample .CSV and concerned workbook(s), I can try to devise a solution for you.


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login


eBook - Manufacturing the Cars of Tomorrow
In this ebook, we'll explore how additive manufacturing is going to transform the way cars are made. This includes commentary from thought leaders such as Ford's CTO, Ken Washington, Customer case studies of ways 3D printing is being used today, and a variety of part examples where 3D printing is already impacting how automobiles are made. Download Now
White Paper - Smart Manufacturing for Semiconductor
New technologies and approaches present great opportunities for semiconductor manufacturers to achieve high levels of innovation, yield and improvement. This white paper explores some of these cutting-edge technologies and how they can be applied effectively in the semiconductor industry. Read about how Smart Manufacturing is transforming the semiconductor industry. Download Now
White Paper - Analysis and Simulation in Aircraft Structure Certification
Organizations using simulation and analysis tools effectively see the benefits in their ability to achieve certification faster and with drastically less total cost than those who do not maximize these tools. Read this White Paper to learn about how digital tools such as analysis and simulation help in aircraft structure certification. Download Now

Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close