ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Call Sub From InputBox (https://www.excelbanter.com/excel-programming/395880-call-sub-inputbox.html)

John Cole, Jr.

Call Sub From InputBox
 
I have written a macro that will loop through every workbook in a
certain directory. I would like to use that for several other macros
that will do things in the workbooks. Is there a way, I can use an
InputBox to call the routine/sub I want to run with the Loop
procedure?

Thanks in Advance,

JC


Don Guillett

Call Sub From InputBox
 
how about
call inputbox("Enter sub to call")

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"John Cole, Jr." wrote in message
oups.com...
I have written a macro that will loop through every workbook in a
certain directory. I would like to use that for several other macros
that will do things in the workbooks. Is there a way, I can use an
InputBox to call the routine/sub I want to run with the Loop
procedure?

Thanks in Advance,

JC



John Cole, Jr.

Call Sub From InputBox
 
On Aug 20, 3:16 pm, "Don Guillett" wrote:
how about
call inputbox("Enter sub to call")

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"John Cole, Jr." wrote in ooglegroups.com...



I have written a macro that will loop through every workbook in a
certain directory. I would like to use that for several other macros
that will do things in the workbooks. Is there a way, I can use an
InputBox to call the routine/sub I want to run with the Loop
procedure?


Thanks in Advance,


JC- Hide quoted text -


- Show quoted text -


Tried that, and I got an error.

JC


joel

Call Sub From InputBox
 
Use the brute force approach

Add string names for the function in the test box like
Function1 Function2 Function3

then read input box
FunctionName = inputbox.text

then use a select function to do the call

select case Function Name
Case "Function 1"
call Function1
Case "Function 2"
call Function2
Case "Function 3"
call Function3
end Select

"John Cole, Jr." wrote:

I have written a macro that will loop through every workbook in a
certain directory. I would like to use that for several other macros
that will do things in the workbooks. Is there a way, I can use an
InputBox to call the routine/sub I want to run with the Loop
procedure?

Thanks in Advance,

JC



Dave Peterson

Call Sub From InputBox
 
application.run YourMacroNameVariableHere
(No checking at all!)

But I wouldn't do this. I'd give the user (including me!) a way to run the
procedure that I wanted.

For additions to the worksheet menu bar, I really like the way John Walkenbach
does it in his menumaker workbook:
http://j-walk.com/ss/excel/tips/tip53.htm

Here's how I do it when I want a toolbar:
http://www.contextures.com/xlToolbar02.html
(from Debra Dalgleish's site)

"John Cole, Jr." wrote:

I have written a macro that will loop through every workbook in a
certain directory. I would like to use that for several other macros
that will do things in the workbooks. Is there a way, I can use an
InputBox to call the routine/sub I want to run with the Loop
procedure?

Thanks in Advance,

JC


--

Dave Peterson

Don Guillett

Call Sub From InputBox
 
Sorry. try this
Application.Run InputBox("Enter sub to call")

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"John Cole, Jr." wrote in message
ups.com...
On Aug 20, 3:16 pm, "Don Guillett" wrote:
how about
call inputbox("Enter sub to call")

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"John Cole, Jr." wrote in
ooglegroups.com...



I have written a macro that will loop through every workbook in a
certain directory. I would like to use that for several other macros
that will do things in the workbooks. Is there a way, I can use an
InputBox to call the routine/sub I want to run with the Loop
procedure?


Thanks in Advance,


JC- Hide quoted text -


- Show quoted text -


Tried that, and I got an error.

JC



John Cole, Jr.

Call Sub From InputBox
 
On Aug 20, 5:25 pm, "Don Guillett" wrote:
Sorry. try this
Application.Run InputBox("Enter sub to call")

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"John Cole, Jr." wrote in oglegroups.com...



On Aug 20, 3:16 pm, "Don Guillett" wrote:
how about
call inputbox("Enter sub to call")


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"John Cole, Jr." wrote in
ooglegroups.com...


I have written a macro that will loop through every workbook in a
certain directory. I would like to use that for several other macros
that will do things in the workbooks. Is there a way, I can use an
InputBox to call the routine/sub I want to run with the Loop
procedure?


Thanks in Advance,


JC- Hide quoted text -


- Show quoted text -


Tried that, and I got an error.


JC- Hide quoted text -


- Show quoted text -


....Like a charm.
Thanks a lot!

JC



All times are GMT +1. The time now is 02:08 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com