Private Sub CommandButton1_Click()
For i = 1 To TextBox2
CallByName UserForm1, textbox1, VbMethod, i
Next
End Sub
Sub cbn(c)
CommandButton1.Caption = c
End Sub
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case. Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
Private Sub CommandButton1_Click()
For i = 1 To TextBox2
CallByName UserForm1, textbox1, VbMethod, i
Next
End Sub
Sub cbn(c)
CommandButton1.Caption = c
End Sub
Thanks, but maybe I'm doing something wrong. I can't get a list of marcos in Textbox1.
All my Macros are stored in NewMacros module as per below screen.
is it even possible to do a check when user is typing the marco name and if it matches then marco from textbox1 will run i times entered in textbox2.
I have also tried to do a combobox instead of textbox1, but still no resault. Does anyone have any ideas ?
Thanks, but maybe I'm doing something wrong. I can't get a list of marcos in Textbox1.
why not use a listbox
the sample code assumed the user would type a macro name into the textbox
are your macros in the userform codepane or a module?
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case. Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
the sample code assumed the user would type a macro name into the textbox
are your macros in the userform codepane or a module?
Hello, yes all of my marcos are in the module (New Marcos).
Yesterday I had a little progress. I managed to create a function GetMarcoList and update the textbox1 to combobox1 in my userform (MULTIPLEBKGS)
Now everyting works almost like I wanted.
**code**
Sub STARTFORM ()
MULTIPLEBKGS.Show
End Sub.
Private Sub cmdStart_Click()
combobox1.MultiLine = True
combobox1.Value = GetMacroList
End Sub
**
The only this is that wrong that
1) GetMarcoList function gets all the marcos from the whole project( all modules, *.xlam* and *.rsf* files) I require only all marcos from "New Marcos" module. Working to get this fixed
2) I can't understand why all marco names are reflecting in combobox1 in one row separated with a comma.
as you do not show the code for getmacrolist it is hard to guess why it does not work as required
try like
Code:
myarr = split(getmacrolist, ",")
for i = 0 to ubound(myarr)
combobox1.additem myarr(i)
next
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case. Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
i can not help with access specific methods (docmd)
the example i posted above using callbyname would work
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case. Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete