Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
lashio
 
Posts: n/a
Default Answering InpBox prompt

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   Report Post  
Dave Peterson
 
Posts: n/a
Default

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   Report Post  
lashio
 
Posts: n/a
Default

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   Report Post  
Dave Peterson
 
Posts: n/a
Default

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   Report Post  
lashio
 
Posts: n/a
Default

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need to turn off prompt about putting on clipboard or not... KyWilde Excel Discussion (Misc queries) 0 April 27th 05 11:37 PM
Password Prompt LuhElle Excel Discussion (Misc queries) 1 March 8th 05 11:11 PM
Save prompt for Excel 2003 Adrastos Setting up and Configuration of Excel 1 February 6th 05 07:54 PM
Excel prompt inaccessible to users JT Excel Discussion (Misc queries) 2 February 4th 05 01:35 AM
Text to Speech prompt Brenda Hutton Excel Discussion (Misc queries) 1 December 3rd 04 02:39 AM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"