K
Kerri
Hi all,
I have created a macro in Word 2003. How can I make one macro have
three different results. In other words. I can copy the macro three
times and give it different names so the users can have a choice of
choose w/o date, w/date or w/date and time. Originally I created user
form so they could choose one of the three options and then passed
that variable result in to a case select statement in my macro. The
powers that be don't want the extra step of clicking in the user
form. They want to choose from the menu one of the three choices and
have it run the macro.
I was trying to avoid having the macro created three times...incase I
need to make a change and update it later. So, what I thought of was
to have a macro that calls the main macro, and use a variable that
will be pulled down in to the main macro. I hope this makes sence?
Here is what I tired with no luck.
Kerri
'This would be the macro that would be in the menu
Sub FtrInfoNOdate()
'I read that if you put the variable in the "(strDateOption )" that
you can call it in other macros, but then it doesn't know what macro
to run...so obviously I'm interpreting it wrong Dim
Dim strDateOption As String
strDateOption = "No Date"
MainMacro
End Sub
'This would be the macro that would be in the menu
Sub FtrInfoYESdate()
'I read that if you put the variable in the "()" that you can call
it in other macros
Dim strDateOption As String
strDateOption = "Yes insert Date"
MainMacro
End Sub
'This would be the macro that would be in the menu
Sub FtrInfoYESdateTime()
'I read that if you put the variable in the "()" that you can call
it in other macros
Dim strDateOption As String
strDateOption = "Yes insert Date & Time"
MainMacro
End Sub
'==============
Sub MainMacro()
Dim strDateOption As String
Select Case strDateOption
Case "No Date"
'using msgbox as example to see its working...I'll replace with
actual code later
MsgBox "Do not insert Date"
Case "Yes Date"
MsgBox "Yes insert Date"
Case "Yes Date & Time"
MsgBox "Yes insert Date & Time"
End Select
'do other things here...
End Sub
I have created a macro in Word 2003. How can I make one macro have
three different results. In other words. I can copy the macro three
times and give it different names so the users can have a choice of
choose w/o date, w/date or w/date and time. Originally I created user
form so they could choose one of the three options and then passed
that variable result in to a case select statement in my macro. The
powers that be don't want the extra step of clicking in the user
form. They want to choose from the menu one of the three choices and
have it run the macro.
I was trying to avoid having the macro created three times...incase I
need to make a change and update it later. So, what I thought of was
to have a macro that calls the main macro, and use a variable that
will be pulled down in to the main macro. I hope this makes sence?
Here is what I tired with no luck.
Kerri
'This would be the macro that would be in the menu
Sub FtrInfoNOdate()
'I read that if you put the variable in the "(strDateOption )" that
you can call it in other macros, but then it doesn't know what macro
to run...so obviously I'm interpreting it wrong Dim
Dim strDateOption As String
strDateOption = "No Date"
MainMacro
End Sub
'This would be the macro that would be in the menu
Sub FtrInfoYESdate()
'I read that if you put the variable in the "()" that you can call
it in other macros
Dim strDateOption As String
strDateOption = "Yes insert Date"
MainMacro
End Sub
'This would be the macro that would be in the menu
Sub FtrInfoYESdateTime()
'I read that if you put the variable in the "()" that you can call
it in other macros
Dim strDateOption As String
strDateOption = "Yes insert Date & Time"
MainMacro
End Sub
'==============
Sub MainMacro()
Dim strDateOption As String
Select Case strDateOption
Case "No Date"
'using msgbox as example to see its working...I'll replace with
actual code later
MsgBox "Do not insert Date"
Case "Yes Date"
MsgBox "Yes insert Date"
Case "Yes Date & Time"
MsgBox "Yes insert Date & Time"
End Select
'do other things here...
End Sub