![]() |
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? |
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? |
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? |
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? |
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? |
All times are GMT +1. The time now is 12:00 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com