Home |
Search |
Today's Posts |
#1
![]() |
|||
|
|||
![]()
Is there any VBA code for answering an InputBox Prompt of another macro.
e.g. running macro "Update_at_dayend" Sub Update_at_dayend() Application.Run "Manual_Input" ' I need a code something like "At prompt, answer = 8.25%" End Sub Sub Manual_Input() Dim ans as variant ans = InputBox(prompt:=" Enter Tax Rate for the area." ' the rest of the program End Sub Thanks |
#2
![]() |
|||
|
|||
![]()
Not that I know of. But if you can see the code for Manual_Input, maybe you can
change it slightly: Option Explicit Sub Update_at_dayend() Call Manual_Input(ans:="8.25%") ' I need a code something like "At prompt, answer = 8.25%" End Sub Sub Manual_Input(Optional ans As Variant = "") If ans = "" Then ans = InputBox(prompt:=" Enter Tax Rate for the area.") End If MsgBox ans ' the rest of the program End Sub And since the code is in the same workbook, I replaced Application.run with a simple Call. lashio wrote: Is there any VBA code for answering an InputBox Prompt of another macro. e.g. running macro "Update_at_dayend" Sub Update_at_dayend() Application.Run "Manual_Input" ' I need a code something like "At prompt, answer = 8.25%" End Sub Sub Manual_Input() Dim ans as variant ans = InputBox(prompt:=" Enter Tax Rate for the area." ' the rest of the program End Sub Thanks -- Dave Peterson |
#3
![]() |
|||
|
|||
![]()
Hi, Dave
What do you call this? Sub Manual_Input(Optional ans As Variant = "") Is it a function? It was not listed as macro; so, it can not be run independently. Thanks "Dave Peterson" wrote in message ... Not that I know of. But if you can see the code for Manual_Input, maybe you can change it slightly: Option Explicit Sub Update_at_dayend() Call Manual_Input(ans:="8.25%") ' I need a code something like "At prompt, answer = 8.25%" End Sub Sub Manual_Input(Optional ans As Variant = "") If ans = "" Then ans = InputBox(prompt:=" Enter Tax Rate for the area.") End If MsgBox ans ' the rest of the program End Sub And since the code is in the same workbook, I replaced Application.run with a simple Call. lashio wrote: Is there any VBA code for answering an InputBox Prompt of another macro. e.g. running macro "Update_at_dayend" Sub Update_at_dayend() Application.Run "Manual_Input" ' I need a code something like "At prompt, answer = 8.25%" End Sub Sub Manual_Input() Dim ans as variant ans = InputBox(prompt:=" Enter Tax Rate for the area." ' the rest of the program End Sub Thanks -- Dave Peterson |
#4
![]() |
|||
|
|||
![]()
It's still a subroutine.
But since it has parameters (even optional parms), you don't see it in the list. You can still type it in the Tools|macro|macros dialog if you want. ===== I find telling people to run macros that way less than optimal. If you want to give the user a nicer interface to run your macros... I use a variation of John Walkenbach's menumaker: http://j-walk.com/ss/excel/tips/tip53.htm to add items to the worksheet menubar. If I want to add a toolbar of my own, here's how I do it: http://groups.google.co.uk/groups?th...5B41%40msn.com lashio wrote: Hi, Dave What do you call this? Sub Manual_Input(Optional ans As Variant = "") Is it a function? It was not listed as macro; so, it can not be run independently. Thanks "Dave Peterson" wrote in message ... Not that I know of. But if you can see the code for Manual_Input, maybe you can change it slightly: Option Explicit Sub Update_at_dayend() Call Manual_Input(ans:="8.25%") ' I need a code something like "At prompt, answer = 8.25%" End Sub Sub Manual_Input(Optional ans As Variant = "") If ans = "" Then ans = InputBox(prompt:=" Enter Tax Rate for the area.") End If MsgBox ans ' the rest of the program End Sub And since the code is in the same workbook, I replaced Application.run with a simple Call. lashio wrote: Is there any VBA code for answering an InputBox Prompt of another macro. e.g. running macro "Update_at_dayend" Sub Update_at_dayend() Application.Run "Manual_Input" ' I need a code something like "At prompt, answer = 8.25%" End Sub Sub Manual_Input() Dim ans as variant ans = InputBox(prompt:=" Enter Tax Rate for the area." ' the rest of the program End Sub Thanks -- Dave Peterson -- Dave Peterson |
#5
![]() |
|||
|
|||
![]()
Thank you very much.
I will look into your suggestion "Dave Peterson" wrote in message ... It's still a subroutine. But since it has parameters (even optional parms), you don't see it in the list. You can still type it in the Tools|macro|macros dialog if you want. ===== I find telling people to run macros that way less than optimal. If you want to give the user a nicer interface to run your macros... I use a variation of John Walkenbach's menumaker: http://j-walk.com/ss/excel/tips/tip53.htm to add items to the worksheet menubar. If I want to add a toolbar of my own, here's how I do it: http://groups.google.co.uk/groups?th...5B41%40msn.com lashio wrote: Hi, Dave What do you call this? Sub Manual_Input(Optional ans As Variant = "") Is it a function? It was not listed as macro; so, it can not be run independently. Thanks "Dave Peterson" wrote in message ... Not that I know of. But if you can see the code for Manual_Input, maybe you can change it slightly: Option Explicit Sub Update_at_dayend() Call Manual_Input(ans:="8.25%") ' I need a code something like "At prompt, answer = 8.25%" End Sub Sub Manual_Input(Optional ans As Variant = "") If ans = "" Then ans = InputBox(prompt:=" Enter Tax Rate for the area.") End If MsgBox ans ' the rest of the program End Sub And since the code is in the same workbook, I replaced Application.run with a simple Call. lashio wrote: Is there any VBA code for answering an InputBox Prompt of another macro. e.g. running macro "Update_at_dayend" Sub Update_at_dayend() Application.Run "Manual_Input" ' I need a code something like "At prompt, answer = 8.25%" End Sub Sub Manual_Input() Dim ans as variant ans = InputBox(prompt:=" Enter Tax Rate for the area." ' the rest of the program End Sub Thanks -- Dave Peterson -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Need to turn off prompt about putting on clipboard or not... | Excel Discussion (Misc queries) | |||
Password Prompt | Excel Discussion (Misc queries) | |||
Save prompt for Excel 2003 | Setting up and Configuration of Excel | |||
Excel prompt inaccessible to users | Excel Discussion (Misc queries) | |||
Text to Speech prompt | Excel Discussion (Misc queries) |