Duvdev
06-10-2014, 02:50 PM
Hello,
Not sure if I am attempting to do something that is not possible but it seems like it should be a very simple/easy procedure. I have a series of previously written UserForms that take user entered values and populates values throughout a document. The userForms have all been tested and work correctly with no issue.
I wanted to take the UserForms functionality a bit further to up processes. Then following the UserForm assignment I was planning on running a macro after each UserForm. If I use a separate macro to simply show the UserForm (example: UserForm1.Show) I have no issue “calling” the individual UserForms.
I have attempted to iterate through the code using something similar to the following:
Sub UserForm_Example ()
Dim Int1 As Integer
Int1 = 0
Dim ObjName As Variant
ObjName = “Object” & Int1 & “_Information”
Dim Status As String
VBA.UserForms(ObjName).Show
Call FirstMacro
Int1 = Int1 + 1
Loop
End Sub
For this example, I would have say 10 different UserForms titles as “Object0_Information”, “Object1_Information”, …
At the ObjName concatenation I am running into a ‘424 Run-Time error, Object Required’ meaning that I need to somehow convert the ObjName results into an object, feed the results into a separate object or maybe use the .Show method in some other way.
Please let me know if anyone has any ideas for making this work. Seems like it should be a really really simple method but I cannot seem to figure it out.
Thank you for your time!
Not sure if I am attempting to do something that is not possible but it seems like it should be a very simple/easy procedure. I have a series of previously written UserForms that take user entered values and populates values throughout a document. The userForms have all been tested and work correctly with no issue.
I wanted to take the UserForms functionality a bit further to up processes. Then following the UserForm assignment I was planning on running a macro after each UserForm. If I use a separate macro to simply show the UserForm (example: UserForm1.Show) I have no issue “calling” the individual UserForms.
I have attempted to iterate through the code using something similar to the following:
Sub UserForm_Example ()
Dim Int1 As Integer
Int1 = 0
Dim ObjName As Variant
ObjName = “Object” & Int1 & “_Information”
Dim Status As String
VBA.UserForms(ObjName).Show
Call FirstMacro
Int1 = Int1 + 1
Loop
End Sub
For this example, I would have say 10 different UserForms titles as “Object0_Information”, “Object1_Information”, …
At the ObjName concatenation I am running into a ‘424 Run-Time error, Object Required’ meaning that I need to somehow convert the ObjName results into an object, feed the results into a separate object or maybe use the .Show method in some other way.
Please let me know if anyone has any ideas for making this work. Seems like it should be a really really simple method but I cannot seem to figure it out.
Thank you for your time!