ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Disable Message Prompt in VBA (https://www.excelbanter.com/excel-programming/311926-disable-message-prompt-vba.html)

ltong

Disable Message Prompt in VBA
 
Hi,

How to disable the message prompt when running a Run macro ?

Below is the example of VBA code for

a)Run macro

Sub Run()
Application.Run "BOT.bankrecon.XLS!Module14.BOT"
End Sub

b)BOT macro

Sub BOT()
Dim Macro1 As String
Range("A12").Select

If Range("A12") = "Done" Then
Macro1 = x
x = False

Else
MsgBox "Please click Once", vbInformation, "Msg Box vbInformation"

Range("A12").Select
Range("A12") = "Done"
End If
End Sub

Please help
Thanks

Regards
Lenard

Tom Ogilvy

Disable Message Prompt in VBA
 
What is the message prompt?

I would suggest you don't name your macro Run since that the name of a built
in procedure - which you are well aware of.

--
Regards,
Tom Ogilvy

"ltong" wrote in message
om...
Hi,

How to disable the message prompt when running a Run macro ?

Below is the example of VBA code for

a)Run macro

Sub Run()
Application.Run "BOT.bankrecon.XLS!Module14.BOT"
End Sub

b)BOT macro

Sub BOT()
Dim Macro1 As String
Range("A12").Select

If Range("A12") = "Done" Then
Macro1 = x
x = False

Else
MsgBox "Please click Once", vbInformation, "Msg Box vbInformation"

Range("A12").Select
Range("A12") = "Done"
End If
End Sub

Please help
Thanks

Regards
Lenard




ltong

Disable Message Prompt in VBA
 
Hi Tom,

Thanks for your prompt reply.

Actually, I've few macros which has to be run sequentially from one to
another ( e.g. Button 1, 2, 3 until 15) in order to execute the
required process. Thus, these macros are being attached with the
message prompt " Please click once, OK ". The purpose of this
procedure is to inform user that this process is allowed to execute
once and thereafter, it will be disable, otherwise the process would
be incorrect.

Since I'd already built in the procedure of message prompt in all
macros at the earlier days and it will take time for me to delete
them, thus just leave them.

Now, if I were to use Run macro which will be run individually and
sequentially from one to another and at the same time, the message
prompt" Please click once, OK" is being disabled, otherwise it will be
irritating to click the message prompt each time the macro is being
run by Run macro.

Therefore, Could I have the solution on how to disable the message
prompt " Please click once, OK" while running the Run macro.

On the other hand, if the Run macro is not used and I were to run few
macros which has to be run individually and sequentially from one to
another, thereafter it will disable in order to execute the required
process. Please advice the correct and effective excel VBA on this
problem as well.

Thanks
Regards
Lenard

"Tom Ogilvy" wrote in message ...
What is the message prompt?

I would suggest you don't name your macro Run since that the name of a built
in procedure - which you are well aware of.

--
Regards,
Tom Ogilvy

"ltong" wrote in message
om...
Hi,

How to disable the message prompt when running a Run macro ?

Below is the example of VBA code for

a)Run macro

Sub Run()
Application.Run "BOT.bankrecon.XLS!Module14.BOT"
End Sub

b)BOT macro

Sub BOT()
Dim Macro1 As String
Range("A12").Select

If Range("A12") = "Done" Then
Macro1 = x
x = False

Else
MsgBox "Please click Once", vbInformation, "Msg Box vbInformation"

Range("A12").Select
Range("A12") = "Done"
End If
End Sub

Please help
Thanks

Regards
Lenard


Tom Ogilvy

Disable Message Prompt in VBA
 
There is no code to suppress the message box if you code has the command to
show it.

You could design your code so you could set a variable value. Then modify
the code to show the msgbox to check that value to decide whether to show
the box or not. (if I understand correctly that sometimes you might want to
show it and other times not).

--
Regards,
Tom Ogilvy

"ltong" wrote in message
om...
Hi Tom,

Thanks for your prompt reply.

Actually, I've few macros which has to be run sequentially from one to
another ( e.g. Button 1, 2, 3 until 15) in order to execute the
required process. Thus, these macros are being attached with the
message prompt " Please click once, OK ". The purpose of this
procedure is to inform user that this process is allowed to execute
once and thereafter, it will be disable, otherwise the process would
be incorrect.

Since I'd already built in the procedure of message prompt in all
macros at the earlier days and it will take time for me to delete
them, thus just leave them.

Now, if I were to use Run macro which will be run individually and
sequentially from one to another and at the same time, the message
prompt" Please click once, OK" is being disabled, otherwise it will be
irritating to click the message prompt each time the macro is being
run by Run macro.

Therefore, Could I have the solution on how to disable the message
prompt " Please click once, OK" while running the Run macro.

On the other hand, if the Run macro is not used and I were to run few
macros which has to be run individually and sequentially from one to
another, thereafter it will disable in order to execute the required
process. Please advice the correct and effective excel VBA on this
problem as well.

Thanks
Regards
Lenard

"Tom Ogilvy" wrote in message

...
What is the message prompt?

I would suggest you don't name your macro Run since that the name of a

built
in procedure - which you are well aware of.

--
Regards,
Tom Ogilvy

"ltong" wrote in message
om...
Hi,

How to disable the message prompt when running a Run macro ?

Below is the example of VBA code for

a)Run macro

Sub Run()
Application.Run "BOT.bankrecon.XLS!Module14.BOT"
End Sub

b)BOT macro

Sub BOT()
Dim Macro1 As String
Range("A12").Select

If Range("A12") = "Done" Then
Macro1 = x
x = False

Else
MsgBox "Please click Once", vbInformation, "Msg Box

vbInformation"

Range("A12").Select
Range("A12") = "Done"
End If
End Sub

Please help
Thanks

Regards
Lenard




ltong

Disable Message Prompt in VBA
 
Hi Tom,

Thanks for your suggestion.

How about the question mentioned in my last message ?

"if the Run macro is not used and I were to run few macros which has
to be run individually and sequentially from one to another (e.g.
Macro1,2,3 to 10 ), thereafter it will disable in order to execute the
required process, otherwise it will generate incorrect result.
Please advice the correct and effective excel VBA on this problem as
well. "

Sorry, I still learning excel VBA and please help, thanks

Regards
Lenard






"Tom Ogilvy" wrote in message ...
There is no code to suppress the message box if you code has the command to
show it.

You could design your code so you could set a variable value. Then modify
the code to show the msgbox to check that value to decide whether to show
the box or not. (if I understand correctly that sometimes you might want to
show it and other times not).

--
Regards,
Tom Ogilvy

"ltong" wrote in message
om...
Hi Tom,

Thanks for your prompt reply.

Actually, I've few macros which has to be run sequentially from one to
another ( e.g. Button 1, 2, 3 until 15) in order to execute the
required process. Thus, these macros are being attached with the
message prompt " Please click once, OK ". The purpose of this
procedure is to inform user that this process is allowed to execute
once and thereafter, it will be disable, otherwise the process would
be incorrect.

Since I'd already built in the procedure of message prompt in all
macros at the earlier days and it will take time for me to delete
them, thus just leave them.

Now, if I were to use Run macro which will be run individually and
sequentially from one to another and at the same time, the message
prompt" Please click once, OK" is being disabled, otherwise it will be
irritating to click the message prompt each time the macro is being
run by Run macro.

Therefore, Could I have the solution on how to disable the message
prompt " Please click once, OK" while running the Run macro.

On the other hand, if the Run macro is not used and I were to run few
macros which has to be run individually and sequentially from one to
another, thereafter it will disable in order to execute the required
process. Please advice the correct and effective excel VBA on this
problem as well.

Thanks
Regards
Lenard

"Tom Ogilvy" wrote in message

...
What is the message prompt?

I would suggest you don't name your macro Run since that the name of a

built
in procedure - which you are well aware of.

--
Regards,
Tom Ogilvy

"ltong" wrote in message
om...
Hi,

How to disable the message prompt when running a Run macro ?

Below is the example of VBA code for

a)Run macro

Sub Run()
Application.Run "BOT.bankrecon.XLS!Module14.BOT"
End Sub

b)BOT macro

Sub BOT()
Dim Macro1 As String
Range("A12").Select

If Range("A12") = "Done" Then
Macro1 = x
x = False

Else
MsgBox "Please click Once", vbInformation, "Msg Box

vbInformation"

Range("A12").Select
Range("A12") = "Done"
End If
End Sub

Please help
Thanks

Regards
Lenard


Tom Ogilvy

Disable Message Prompt in VBA
 
Public bSuppress as Boolean

Sub RunAll()
bSuppress = True
Macro1
Macro2
Macro3
bSuppress = False
End Sub

Sub Macro1()
if not bSuppress then
msgbox "Only run once"
end if
end Sub

Sub Macro2()
If not bSuppress then
msgbox "Only run once"
end if
End Sub

Sub Macro3()
If not bSuppress then
msgbox "Only run once"
End if
End Sub

--
Regards,
Tom Ogilvy

"ltong" wrote in message
om...
Hi Tom,

Thanks for your suggestion.

How about the question mentioned in my last message ?

"if the Run macro is not used and I were to run few macros which has
to be run individually and sequentially from one to another (e.g.
Macro1,2,3 to 10 ), thereafter it will disable in order to execute the
required process, otherwise it will generate incorrect result.
Please advice the correct and effective excel VBA on this problem as
well. "

Sorry, I still learning excel VBA and please help, thanks

Regards
Lenard






"Tom Ogilvy" wrote in message

...
There is no code to suppress the message box if you code has the

command to
show it.

You could design your code so you could set a variable value. Then

modify
the code to show the msgbox to check that value to decide whether to

show
the box or not. (if I understand correctly that sometimes you might want

to
show it and other times not).

--
Regards,
Tom Ogilvy

"ltong" wrote in message
om...
Hi Tom,

Thanks for your prompt reply.

Actually, I've few macros which has to be run sequentially from one to
another ( e.g. Button 1, 2, 3 until 15) in order to execute the
required process. Thus, these macros are being attached with the
message prompt " Please click once, OK ". The purpose of this
procedure is to inform user that this process is allowed to execute
once and thereafter, it will be disable, otherwise the process would
be incorrect.

Since I'd already built in the procedure of message prompt in all
macros at the earlier days and it will take time for me to delete
them, thus just leave them.

Now, if I were to use Run macro which will be run individually and
sequentially from one to another and at the same time, the message
prompt" Please click once, OK" is being disabled, otherwise it will be
irritating to click the message prompt each time the macro is being
run by Run macro.

Therefore, Could I have the solution on how to disable the message
prompt " Please click once, OK" while running the Run macro.

On the other hand, if the Run macro is not used and I were to run few
macros which has to be run individually and sequentially from one to
another, thereafter it will disable in order to execute the required
process. Please advice the correct and effective excel VBA on this
problem as well.

Thanks
Regards
Lenard

"Tom Ogilvy" wrote in message

...
What is the message prompt?

I would suggest you don't name your macro Run since that the name of

a
built
in procedure - which you are well aware of.

--
Regards,
Tom Ogilvy

"ltong" wrote in message
om...
Hi,

How to disable the message prompt when running a Run macro ?

Below is the example of VBA code for

a)Run macro

Sub Run()
Application.Run "BOT.bankrecon.XLS!Module14.BOT"
End Sub

b)BOT macro

Sub BOT()
Dim Macro1 As String
Range("A12").Select

If Range("A12") = "Done" Then
Macro1 = x
x = False

Else
MsgBox "Please click Once", vbInformation, "Msg Box

vbInformation"

Range("A12").Select
Range("A12") = "Done"
End If
End Sub

Please help
Thanks

Regards
Lenard




ltong

Disable Message Prompt in VBA
 
Hi Tom,

It seems that the suggested VBA code does not work according to the
situation as per my last question and the macros can still be run in
any order ( ie the macro2 and 3 are only allowed to run after macro1
is executed and so on )

Perhaps, I misunderstood on your suggested VBA code

Let make a simple scenario and checks the VBA code is correct : -

Public bSuppress As Boolean

Sub RunAll()
bSuppress = True
Macro1
Macro2
Macro3
bSuppress = False
End Sub

Sub Macro1()
If Not bSuppress Then
MsgBox "Only run once"
Range("A1:A28").Select
Selection.Font.Bold = True
End If
End Sub

Sub Macro2()
If Not bSuppress Then
MsgBox "Only run once"
ActiveWindow.ScrollColumn = 1
Range("A1:C28").Select
Selection.Font.ColorIndex = 3
End If
End Sub

Sub Macro3()
If Not bSuppress Then
MsgBox "Only run once"
Range("A1:C28").Select
Selection.Font.Underline = xlUnderlineStyleSingle
End If
End Sub

Regards
Lenard

"Tom Ogilvy" wrote in message ...
Public bSuppress as Boolean

Sub RunAll()
bSuppress = True
Macro1
Macro2
Macro3
bSuppress = False
End Sub

Sub Macro1()
if not bSuppress then
msgbox "Only run once"
end if
end Sub

Sub Macro2()
If not bSuppress then
msgbox "Only run once"
end if
End Sub

Sub Macro3()
If not bSuppress then
msgbox "Only run once"
End if
End Sub

--
Regards,
Tom Ogilvy

"ltong" wrote in message
om...
Hi Tom,

Thanks for your suggestion.

How about the question mentioned in my last message ?

"if the Run macro is not used and I were to run few macros which has
to be run individually and sequentially from one to another (e.g.
Macro1,2,3 to 10 ), thereafter it will disable in order to execute the
required process, otherwise it will generate incorrect result.
Please advice the correct and effective excel VBA on this problem as
well. "

Sorry, I still learning excel VBA and please help, thanks

Regards
Lenard






"Tom Ogilvy" wrote in message

...
There is no code to suppress the message box if you code has the

command to
show it.

You could design your code so you could set a variable value. Then

modify
the code to show the msgbox to check that value to decide whether to

show
the box or not. (if I understand correctly that sometimes you might want

to
show it and other times not).

--
Regards,
Tom Ogilvy

"ltong" wrote in message
om...
Hi Tom,

Thanks for your prompt reply.

Actually, I've few macros which has to be run sequentially from one to
another ( e.g. Button 1, 2, 3 until 15) in order to execute the
required process. Thus, these macros are being attached with the
message prompt " Please click once, OK ". The purpose of this
procedure is to inform user that this process is allowed to execute
once and thereafter, it will be disable, otherwise the process would
be incorrect.

Since I'd already built in the procedure of message prompt in all
macros at the earlier days and it will take time for me to delete
them, thus just leave them.

Now, if I were to use Run macro which will be run individually and
sequentially from one to another and at the same time, the message
prompt" Please click once, OK" is being disabled, otherwise it will be
irritating to click the message prompt each time the macro is being
run by Run macro.

Therefore, Could I have the solution on how to disable the message
prompt " Please click once, OK" while running the Run macro.

On the other hand, if the Run macro is not used and I were to run few
macros which has to be run individually and sequentially from one to
another, thereafter it will disable in order to execute the required
process. Please advice the correct and effective excel VBA on this
problem as well.

Thanks
Regards
Lenard

"Tom Ogilvy" wrote in message

...
What is the message prompt?

I would suggest you don't name your macro Run since that the name of

a
built
in procedure - which you are well aware of.

--
Regards,
Tom Ogilvy

"ltong" wrote in message
om...
Hi,

How to disable the message prompt when running a Run macro ?

Below is the example of VBA code for

a)Run macro

Sub Run()
Application.Run "BOT.bankrecon.XLS!Module14.BOT"
End Sub

b)BOT macro

Sub BOT()
Dim Macro1 As String
Range("A12").Select

If Range("A12") = "Done" Then
Macro1 = x
x = False

Else
MsgBox "Please click Once", vbInformation, "Msg Box

vbInformation"

Range("A12").Select
Range("A12") = "Done"
End If
End Sub

Please help
Thanks

Regards
Lenard



All times are GMT +1. The time now is 04:38 AM.

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