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 Errors 1004

I have this file that has only 1 generic userform had been loading upon
clicking a commandbutton. The command buttons are generically called
commandbutton1 on 12 different worksheets and are such:

Private Sub CommandButton1_Click()
loadform
End Sub

sub Loadform is located in module 1 and goes like this:

Sub loadform()
Load UserForm1
UserForm1.Show
End Sub

When I say generic, I mean that I just save the old one as a new file name
and clear out some values in some cells. However, I am now getting an error
message that reads that there is a runtime error 1004 due to
application-defined or object-defined error. This should be a very simple
yet stupid thing that I am overseeing. I haven't not changed the code for
the userform initialization and when I go back to the files created in the
prior months, I do not run into this problem. Is it possible the file and/or
userform has gotten corrupted as it is often operated in Share mode?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 747
Default Loading Userform Errors 1004

Run the UserForm_Initialize procedure directly from the UF code module and
see if it selects the code causing the error.

Regards,
Greg

"Steven Cheng" wrote:

I have this file that has only 1 generic userform had been loading upon
clicking a commandbutton. The command buttons are generically called
commandbutton1 on 12 different worksheets and are such:

Private Sub CommandButton1_Click()
loadform
End Sub

sub Loadform is located in module 1 and goes like this:

Sub loadform()
Load UserForm1
UserForm1.Show
End Sub

When I say generic, I mean that I just save the old one as a new file name
and clear out some values in some cells. However, I am now getting an error
message that reads that there is a runtime error 1004 due to
application-defined or object-defined error. This should be a very simple
yet stupid thing that I am overseeing. I haven't not changed the code for
the userform initialization and when I go back to the files created in the
prior months, I do not run into this problem. Is it possible the file and/or
userform has gotten corrupted as it is often operated in Share mode?

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

Greg;

just a thought. if the name of the userform is Userform1, then shouldn't
the procedure be called Userform_Initialize?

"Greg Wilson" wrote:

Run the UserForm_Initialize procedure directly from the UF code module and
see if it selects the code causing the error.

Regards,
Greg

"Steven Cheng" wrote:

I have this file that has only 1 generic userform had been loading upon
clicking a commandbutton. The command buttons are generically called
commandbutton1 on 12 different worksheets and are such:

Private Sub CommandButton1_Click()
loadform
End Sub

sub Loadform is located in module 1 and goes like this:

Sub loadform()
Load UserForm1
UserForm1.Show
End Sub

When I say generic, I mean that I just save the old one as a new file name
and clear out some values in some cells. However, I am now getting an error
message that reads that there is a runtime error 1004 due to
application-defined or object-defined error. This should be a very simple
yet stupid thing that I am overseeing. I haven't not changed the code for
the userform initialization and when I go back to the files created in the
prior months, I do not run into this problem. Is it possible the file and/or
userform has gotten corrupted as it is often operated in Share mode?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 747
Default Loading Userform Errors 1004

If the name of the UF is UserForm1 then the event procedure should still be
called UserForm_Initialize if that's what you were asking.

What I meant by my suggestion is that if you run the Initialize (or
Activate) code from within the UF's code module it will typically highlight
the offending code. In contrast, showing it with a UserForm1.Show command
from a outside procedure will typically only return the error description.

1. From within the VBE right click the UF
2. Select View Code
3. Place the cursor anywhere inside the UserForm_Initialize procedure and
click the Continue button (little blue triangle on its side) on the VBE's
Standard toolbar.

Greg

"Steven Cheng" wrote:

Greg;

just a thought. if the name of the userform is Userform1, then shouldn't
the procedure be called Userform_Initialize?

"Greg Wilson" wrote:

Run the UserForm_Initialize procedure directly from the UF code module and
see if it selects the code causing the error.

Regards,
Greg

"Steven Cheng" wrote:

I have this file that has only 1 generic userform had been loading upon
clicking a commandbutton. The command buttons are generically called
commandbutton1 on 12 different worksheets and are such:

Private Sub CommandButton1_Click()
loadform
End Sub

sub Loadform is located in module 1 and goes like this:

Sub loadform()
Load UserForm1
UserForm1.Show
End Sub

When I say generic, I mean that I just save the old one as a new file name
and clear out some values in some cells. However, I am now getting an error
message that reads that there is a runtime error 1004 due to
application-defined or object-defined error. This should be a very simple
yet stupid thing that I am overseeing. I haven't not changed the code for
the userform initialization and when I go back to the files created in the
prior months, I do not run into this problem. Is it possible the file and/or
userform has gotten corrupted as it is often operated in Share mode?

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

Greg;

thanks. did it and found the culprit of my problems. it wasn't the Load
command but rather the Initialization as you had pointed out. My range
references were no longer valid. Thanks for the help.

Steven
"Greg Wilson" wrote:

If the name of the UF is UserForm1 then the event procedure should still be
called UserForm_Initialize if that's what you were asking.

What I meant by my suggestion is that if you run the Initialize (or
Activate) code from within the UF's code module it will typically highlight
the offending code. In contrast, showing it with a UserForm1.Show command
from a outside procedure will typically only return the error description.

1. From within the VBE right click the UF
2. Select View Code
3. Place the cursor anywhere inside the UserForm_Initialize procedure and
click the Continue button (little blue triangle on its side) on the VBE's
Standard toolbar.

Greg

"Steven Cheng" wrote:

Greg;

just a thought. if the name of the userform is Userform1, then shouldn't
the procedure be called Userform_Initialize?

"Greg Wilson" wrote:

Run the UserForm_Initialize procedure directly from the UF code module and
see if it selects the code causing the error.

Regards,
Greg

"Steven Cheng" wrote:

I have this file that has only 1 generic userform had been loading upon
clicking a commandbutton. The command buttons are generically called
commandbutton1 on 12 different worksheets and are such:

Private Sub CommandButton1_Click()
loadform
End Sub

sub Loadform is located in module 1 and goes like this:

Sub loadform()
Load UserForm1
UserForm1.Show
End Sub

When I say generic, I mean that I just save the old one as a new file name
and clear out some values in some cells. However, I am now getting an error
message that reads that there is a runtime error 1004 due to
application-defined or object-defined error. This should be a very simple
yet stupid thing that I am overseeing. I haven't not changed the code for
the userform initialization and when I go back to the files created in the
prior months, I do not run into this problem. Is it possible the file and/or
userform has gotten corrupted as it is often operated in Share mode?



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
Loading a Userform Jason Zischke Excel Programming 2 March 13th 06 08:37 AM
Loading website from userform Danny Boy via OfficeKB.com Excel Programming 0 January 29th 06 04:09 PM
Loading Userform Steven Cheng Excel Programming 3 December 9th 05 07:18 PM
Loading UserForm gives error Mats Samson Excel Programming 3 August 3rd 05 08:06 AM
More 1004 Errors... Jim Berglund Excel Programming 1 May 8th 04 03:20 AM


All times are GMT +1. The time now is 01:13 AM.

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

About Us

"It's about Microsoft Excel"