View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
John Wilson John Wilson is offline
external usenet poster
 
Posts: 550
Default One Single Message Box for chained macros

Shatin,

You could use the ideas that I gave you before or play around
with something like this:

Public MyVal As String
Sub TestMe()
MyVal = "12/22/04"
If IsDate(MyVal)
Range("A1") = InputBox(prompt:="Message", Title:="Title", Default:=MyVal)
Else
' your original InputBox (without the date being populated)
End If
End Sub

With the above, set MyVal from each of the InputBoxes.
If there's a date in that variable, it'll use it and if not, it'll
have you
fill it in.

As an afterthought, if MyVal is nothing, you don't even need the
IF statement

Public MyVal as String
Sub TestMe2()

Range("A1") = InputBox(prompt:="Message", Title:="Title", Default:=MyVal)
End Sub

You might want to reset MyVal at some point as it'll be there as long
as the workbook is opened (maybe at the very end of the last macro)??

John


"Shatin" wrote in message
...
Oops, you are right. I mean Input Box.

"John Wilson" wrote in message
...
Shatin,

Is it a message box?? I kinda doubt it because you can't
input data to a message box.
Is it an InputBox or a UserForm??

Without seeing the code, it's difficult to answer your question.

What you could do is set a public variable in a regular module
and populate it with the date from any of your ??boxes.
Then you could check for that date.
For an InputBox, just use an IF statement before it.

If IsDate(MyDate) = false Then
' show my input box
End If

Or if it's a text box on a UserForm......
In the Activate Event.

If IsDate(MyDate) Then
TextBox1 = MyDate
End If

John

"Shatin" wrote in message
...
I have several macros which are all to do with file generations. They

all
begin with a message box asking for a date. The resulting filenames

depend
on the date entered, e.g. "macro1 02/02/04", "macro2 02/02/04". I have
written a master macro chaining these macros together. The hassle is

when
the master macro is run, I'd be prompted by the various message boxes

which
belong to the individual macros. Is there anyway I can put some code

in
the
master macro so that when the message boxes come up, they'd all get

the
same
date? Obviously I don't want to change the individual macros because

they
are still needed as standalone macros from time to time.

TIA.