Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Loading Userform

I am having some challenges on getting a command button to load and show a
user form

this is the code for the command button on each of the worksheets to load
and show the userform:

Private Sub CommandButton1_Click()
LoadForm
End Sub

this is the code for LoadForm which is located in a module.

Sub LoadForm()
Load UserForm1
UserForm1.Show
End Sub

I can't see why that I am getting an error message that indicates the
application-defined or object defined error.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Loading Userform

Change the "CommandButton1" to just "Button1".

It should work fine.

Brian



"Steven Cheng" wrote in message
...
I am having some challenges on getting a command button to load and show a
user form

this is the code for the command button on each of the worksheets to load
and show the userform:

Private Sub CommandButton1_Click()
LoadForm
End Sub

this is the code for LoadForm which is located in a module.

Sub LoadForm()
Load UserForm1
UserForm1.Show
End Sub

I can't see why that I am getting an error message that indicates the
application-defined or object defined error.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Loading Userform

Thanks for responding Brian. However, I changed the button name but it sill
came up with the same error message.

Is there something else that I am missing?

"Steven Cheng" wrote:

I am having some challenges on getting a command button to load and show a
user form

this is the code for the command button on each of the worksheets to load
and show the userform:

Private Sub CommandButton1_Click()
LoadForm
End Sub

this is the code for LoadForm which is located in a module.

Sub LoadForm()
Load UserForm1
UserForm1.Show
End Sub

I can't see why that I am getting an error message that indicates the
application-defined or object defined error.

  #4   Report Post  
Posted to microsoft.public.excel.programming
JNW JNW is offline
external usenet poster
 
Posts: 480
Default Loading Userform

Remove "Load UserForm1". UserForm1.show will work to open the form.

If that doesn't work than you'll need to check the names of the button and
the userform. if you change those names the events and macros will no longer
work.

"Steven Cheng" wrote:

I am having some challenges on getting a command button to load and show a
user form

this is the code for the command button on each of the worksheets to load
and show the userform:

Private Sub CommandButton1_Click()
LoadForm
End Sub

this is the code for LoadForm which is located in a module.

Sub LoadForm()
Load UserForm1
UserForm1.Show
End Sub

I can't see why that I am getting an error message that indicates the
application-defined or object defined error.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Failed userform loading and cause application crash noiseash Excel Programming 1 August 25th 05 03:35 PM
Loading graphic into top left strip of userform ExcelMonkey Excel Programming 3 August 23rd 05 11:50 AM
Loading UserForm gives error Mats Samson Excel Programming 3 August 3rd 05 08:06 AM
Looping procedure calls userform; how to exit loop (via userform button)? KR Excel Programming 6 July 27th 05 12:57 PM
Loading UserForm on start up. Kobus Excel Programming 2 April 1st 05 11:13 AM


All times are GMT +1. The time now is 01:40 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"