PC Review


Reply
Thread Tools Rate Thread

Call Sub From InputBox

 
 
John Cole, Jr.
Guest
Posts: n/a
 
      20th Aug 2007
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

 
Reply With Quote
 
 
 
 
Don Guillett
Guest
Posts: n/a
 
      20th Aug 2007
how about
call inputbox("Enter sub to call")

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
(E-Mail Removed)
"John Cole, Jr." <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>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
>


 
Reply With Quote
 
John Cole, Jr.
Guest
Posts: n/a
 
      20th Aug 2007
On Aug 20, 3:16 pm, "Don Guillett" <dguille...@austin.rr.com> wrote:
> how about
> call inputbox("Enter sub to call")
>
> --
> Don Guillett
> Microsoft MVP Excel
> SalesAid Software
> dguille...@austin.rr.com
> "John Cole, Jr." <john.c...@shawgrp.com> wrote in messagenews:(E-Mail Removed)...
>
>
>
> >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

 
Reply With Quote
 
=?Utf-8?B?Sm9lbA==?=
Guest
Posts: n/a
 
      20th Aug 2007
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
>
>

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      20th Aug 2007
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
 
Reply With Quote
 
Don Guillett
Guest
Posts: n/a
 
      20th Aug 2007
Sorry. try this
Application.Run InputBox("Enter sub to call")

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
(E-Mail Removed)
"John Cole, Jr." <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> On Aug 20, 3:16 pm, "Don Guillett" <dguille...@austin.rr.com> wrote:
>> how about
>> call inputbox("Enter sub to call")
>>
>> --
>> Don Guillett
>> Microsoft MVP Excel
>> SalesAid Software
>> dguille...@austin.rr.com
>> "John Cole, Jr." <john.c...@shawgrp.com> wrote in
>> messagenews:(E-Mail Removed)...
>>
>>
>>
>> >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
>


 
Reply With Quote
 
John Cole, Jr.
Guest
Posts: n/a
 
      20th Aug 2007
On Aug 20, 5:25 pm, "Don Guillett" <dguille...@austin.rr.com> wrote:
> Sorry. try this
> Application.Run InputBox("Enter sub to call")
>
> --
> Don Guillett
> Microsoft MVP Excel
> SalesAid Software
> dguille...@austin.rr.com
> "John Cole, Jr." <john.c...@shawgrp.com> wrote in messagenews:(E-Mail Removed)...
>
>
>
> > On Aug 20, 3:16 pm, "Don Guillett" <dguille...@austin.rr.com> wrote:
> >> how about
> >> call inputbox("Enter sub to call")

>
> >> --
> >> Don Guillett
> >> Microsoft MVP Excel
> >> SalesAid Software
> >> dguille...@austin.rr.com
> >> "John Cole, Jr." <john.c...@shawgrp.com> wrote in
> >> messagenews:(E-Mail Removed)...

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

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
InputBox Mask ****** & Call it 3 times. Andy Microsoft Access VBA Modules 14 18th Oct 2005 05:41 PM
InputBox Mask ****** & Call it 3 times. Andy Microsoft Access Forms 14 18th Oct 2005 05:41 PM
InputBox Mask ****** & Call it 3 times. Andy Microsoft Access Form Coding 14 18th Oct 2005 05:41 PM
Warning 1684 CA2214 : Microsoft.Usage : 'RandomShade..ctor(Int32, Int32, Int32, Int32, Int32)' contains a call chain that results in a call to a virtual method defined by the class. Review the following call stack for unintended consequences: steve bull Microsoft C# .NET 4 7th Jul 2005 05:54 PM
Inputbox and Application.InputBox Maria Microsoft Excel Programming 1 20th Sep 2004 11:36 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:09 PM.