ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Application run help! (https://www.excelbanter.com/excel-programming/339516-application-run-help.html)

Windsong1948

Application run help!
 
I have 10 macros in a workbook. I want to write one macro that will allow
the user to input any one of the 10 macros they want to run. When I have
needed a macro for my work I have gotten by over the years with the basics
but this has me stumped. What I have written is shown below: What have I
done wrong?

Sub Macro1 ()
Dim MyName As String
MyName = InputBox("Enter Scan + Qty Scanned", "Enter Quantity you Scanned",
"Scan1")
ActiveWorkbook.Application.run = MyName
End Sub



Tom Ogilvy

Application run help!
 
Assuming the macros to be run are in a general module of the activeworkbook.

Sub Macro1 ()
Dim MyName As String
MyName = InputBox("Enter Scan + Qty Scanned", "Enter Quantity you Scanned",
"Scan1")
Application.run = "'" & ActiveWorkbook.Name & "'!" & MyName
End Sub


--
Regards,
Tom Ogilvy



"Windsong1948" wrote in message
...
I have 10 macros in a workbook. I want to write one macro that will allow
the user to input any one of the 10 macros they want to run. When I have
needed a macro for my work I have gotten by over the years with the basics
but this has me stumped. What I have written is shown below: What have I
done wrong?

Sub Macro1 ()
Dim MyName As String
MyName = InputBox("Enter Scan + Qty Scanned", "Enter Quantity you

Scanned",
"Scan1")
ActiveWorkbook.Application.run = MyName
End Sub





Windsong1948

Application run help!
 
I wrote in exactly what you said to write & the macro still doesn't run &
highlights the line I typed in yellow? It is a general module & All 10
macros are in the same module. The macros are named Scan1 thru Scan10.
Any ideas what is wrong - this is in Excel 2003 - Has the VBA changed for
that version?

"Tom Ogilvy" wrote:

Assuming the macros to be run are in a general module of the activeworkbook.

Sub Macro1 ()
Dim MyName As String
MyName = InputBox("Enter Scan + Qty Scanned", "Enter Quantity you Scanned",
"Scan1")
Application.run = "'" & ActiveWorkbook.Name & "'!" & MyName
End Sub


--
Regards,
Tom Ogilvy



"Windsong1948" wrote in message
...
I have 10 macros in a workbook. I want to write one macro that will allow
the user to input any one of the 10 macros they want to run. When I have
needed a macro for my work I have gotten by over the years with the basics
but this has me stumped. What I have written is shown below: What have I
done wrong?

Sub Macro1 ()
Dim MyName As String
MyName = InputBox("Enter Scan + Qty Scanned", "Enter Quantity you

Scanned",
"Scan1")
ActiveWorkbook.Application.run = MyName
End Sub






Tom Ogilvy

Application run help!
 
My oversight. I edited your macro and forgot to take out the Equal sign you
had included. Just remove that:

Sub Macro1()
Dim MyName As String
MyName = InputBox("Enter Scan + Qty Scanned", _
"Enter Quantity you Scanned", "Scan1")
Application.Run "'" & ActiveWorkbook.Name & "'!" & MyName
End Sub

--
Regards,
Tom Ogilvy


"Windsong1948" wrote in message
...
I wrote in exactly what you said to write & the macro still doesn't run &
highlights the line I typed in yellow? It is a general module & All 10
macros are in the same module. The macros are named Scan1 thru Scan10.
Any ideas what is wrong - this is in Excel 2003 - Has the VBA changed for
that version?

"Tom Ogilvy" wrote:

Assuming the macros to be run are in a general module of the

activeworkbook.

Sub Macro1 ()
Dim MyName As String
MyName = InputBox("Enter Scan + Qty Scanned", "Enter Quantity you

Scanned",
"Scan1")
Application.run = "'" & ActiveWorkbook.Name & "'!" & MyName
End Sub


--
Regards,
Tom Ogilvy



"Windsong1948" wrote in message
...
I have 10 macros in a workbook. I want to write one macro that will

allow
the user to input any one of the 10 macros they want to run. When I

have
needed a macro for my work I have gotten by over the years with the

basics
but this has me stumped. What I have written is shown below: What

have I
done wrong?

Sub Macro1 ()
Dim MyName As String
MyName = InputBox("Enter Scan + Qty Scanned", "Enter Quantity you

Scanned",
"Scan1")
ActiveWorkbook.Application.run = MyName
End Sub








Windsong1948

Application run help!
 
After 1-1/2 weeks of frustration in trying to figure this out I can only say
Thank you! Thank you! Thank you! This works!

"Tom Ogilvy" wrote:

My oversight. I edited your macro and forgot to take out the Equal sign you
had included. Just remove that:

Sub Macro1()
Dim MyName As String
MyName = InputBox("Enter Scan + Qty Scanned", _
"Enter Quantity you Scanned", "Scan1")
Application.Run "'" & ActiveWorkbook.Name & "'!" & MyName
End Sub

--
Regards,
Tom Ogilvy


"Windsong1948" wrote in message
...
I wrote in exactly what you said to write & the macro still doesn't run &
highlights the line I typed in yellow? It is a general module & All 10
macros are in the same module. The macros are named Scan1 thru Scan10.
Any ideas what is wrong - this is in Excel 2003 - Has the VBA changed for
that version?

"Tom Ogilvy" wrote:

Assuming the macros to be run are in a general module of the

activeworkbook.

Sub Macro1 ()
Dim MyName As String
MyName = InputBox("Enter Scan + Qty Scanned", "Enter Quantity you

Scanned",
"Scan1")
Application.run = "'" & ActiveWorkbook.Name & "'!" & MyName
End Sub


--
Regards,
Tom Ogilvy



"Windsong1948" wrote in message
...
I have 10 macros in a workbook. I want to write one macro that will

allow
the user to input any one of the 10 macros they want to run. When I

have
needed a macro for my work I have gotten by over the years with the

basics
but this has me stumped. What I have written is shown below: What

have I
done wrong?

Sub Macro1 ()
Dim MyName As String
MyName = InputBox("Enter Scan + Qty Scanned", "Enter Quantity you
Scanned",
"Scan1")
ActiveWorkbook.Application.run = MyName
End Sub









Windsong1948

Application run help!-Trouble you again?
 
How would you write this so it would run from the personal workbook? Please?

"Tom Ogilvy" wrote:

My oversight. I edited your macro and forgot to take out the Equal sign you
had included. Just remove that:

Sub Macro1()
Dim MyName As String
MyName = InputBox("Enter Scan + Qty Scanned", _
"Enter Quantity you Scanned", "Scan1")
Application.Run "'" & ActiveWorkbook.Name & "'!" & MyName
End Sub

--
Regards,
Tom Ogilvy


"Windsong1948" wrote in message
...
I wrote in exactly what you said to write & the macro still doesn't run &
highlights the line I typed in yellow? It is a general module & All 10
macros are in the same module. The macros are named Scan1 thru Scan10.
Any ideas what is wrong - this is in Excel 2003 - Has the VBA changed for
that version?

"Tom Ogilvy" wrote:

Assuming the macros to be run are in a general module of the

activeworkbook.

Sub Macro1 ()
Dim MyName As String
MyName = InputBox("Enter Scan + Qty Scanned", "Enter Quantity you

Scanned",
"Scan1")
Application.run = "'" & ActiveWorkbook.Name & "'!" & MyName
End Sub


--
Regards,
Tom Ogilvy



"Windsong1948" wrote in message
...
I have 10 macros in a workbook. I want to write one macro that will

allow
the user to input any one of the 10 macros they want to run. When I

have
needed a macro for my work I have gotten by over the years with the

basics
but this has me stumped. What I have written is shown below: What

have I
done wrong?

Sub Macro1 ()
Dim MyName As String
MyName = InputBox("Enter Scan + Qty Scanned", "Enter Quantity you
Scanned",
"Scan1")
ActiveWorkbook.Application.run = MyName
End Sub









Tom Ogilvy

Application run help!-Trouble you again?
 
Sub Macro1()
Dim MyName As String
MyName = InputBox("Enter Scan + Qty Scanned", _
"Enter Quantity you Scanned", "Scan1")
Application.Run "Personal.xls!" & MyName
End Sub


--
Regards,
Tom Ogilvy

"Windsong1948" wrote in message
...
How would you write this so it would run from the personal workbook?

Please?

"Tom Ogilvy" wrote:

My oversight. I edited your macro and forgot to take out the Equal sign

you
had included. Just remove that:

Sub Macro1()
Dim MyName As String
MyName = InputBox("Enter Scan + Qty Scanned", _
"Enter Quantity you Scanned", "Scan1")
Application.Run "'" & ActiveWorkbook.Name & "'!" & MyName
End Sub

--
Regards,
Tom Ogilvy


"Windsong1948" wrote in message
...
I wrote in exactly what you said to write & the macro still doesn't

run &
highlights the line I typed in yellow? It is a general module & All

10
macros are in the same module. The macros are named Scan1 thru

Scan10.
Any ideas what is wrong - this is in Excel 2003 - Has the VBA changed

for
that version?

"Tom Ogilvy" wrote:

Assuming the macros to be run are in a general module of the

activeworkbook.

Sub Macro1 ()
Dim MyName As String
MyName = InputBox("Enter Scan + Qty Scanned", "Enter Quantity you

Scanned",
"Scan1")
Application.run = "'" & ActiveWorkbook.Name & "'!" & MyName
End Sub


--
Regards,
Tom Ogilvy



"Windsong1948" wrote in

message
...
I have 10 macros in a workbook. I want to write one macro that wi

ll
allow
the user to input any one of the 10 macros they want to run. When

I
have
needed a macro for my work I have gotten by over the years with

the
basics
but this has me stumped. What I have written is shown below:

What
have I
done wrong?

Sub Macro1 ()
Dim MyName As String
MyName = InputBox("Enter Scan + Qty Scanned", "Enter Quantity you
Scanned",
"Scan1")
ActiveWorkbook.Application.run = MyName
End Sub












All times are GMT +1. The time now is 04:57 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com