ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Msg Box VBA Issue (https://www.excelbanter.com/excel-programming/381947-msg-box-vba-issue.html)

CJLuke

Msg Box VBA Issue
 
I am using the following code:

Sub MBox()
Dim Config as Integer
Dim Ans As Integer
Config = vbYesNo + vbQuestion + vbDefaultButton2
Ans = MsgBox("Are you sure the correct Axiom reports are open in Excel?",
Config)
If Ans = vbYes Then RunReport
Then I have the report code
End Sub

Everything is just fine and dandy - the box pops up with yes and no - but
when I click Yes nothing happens. When I click No, the report runs for
however many times I clicked Yes. It is very strange. Any suggestions on how
to get this to work properly?

Charles

Bob Phillips

Msg Box VBA Issue
 
Works as expected for me.

--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"CJLuke" wrote in message
...
I am using the following code:

Sub MBox()
Dim Config as Integer
Dim Ans As Integer
Config = vbYesNo + vbQuestion + vbDefaultButton2
Ans = MsgBox("Are you sure the correct Axiom reports are open in Excel?",
Config)
If Ans = vbYes Then RunReport
Then I have the report code
End Sub

Everything is just fine and dandy - the box pops up with yes and no - but
when I click Yes nothing happens. When I click No, the report runs for
however many times I clicked Yes. It is very strange. Any suggestions on
how
to get this to work properly?

Charles




CJLuke

Msg Box VBA Issue
 
Still screwy on my end...any suggestions? What does your code look like?

"Bob Phillips" wrote:

Works as expected for me.

--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"CJLuke" wrote in message
...
I am using the following code:

Sub MBox()
Dim Config as Integer
Dim Ans As Integer
Config = vbYesNo + vbQuestion + vbDefaultButton2
Ans = MsgBox("Are you sure the correct Axiom reports are open in Excel?",
Config)
If Ans = vbYes Then RunReport
Then I have the report code
End Sub

Everything is just fine and dandy - the box pops up with yes and no - but
when I click Yes nothing happens. When I click No, the report runs for
however many times I clicked Yes. It is very strange. Any suggestions on
how
to get this to work properly?

Charles





Bob Phillips

Msg Box VBA Issue
 
I just copied your code.

--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"CJLuke" wrote in message
...
Still screwy on my end...any suggestions? What does your code look like?

"Bob Phillips" wrote:

Works as expected for me.

--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"CJLuke" wrote in message
...
I am using the following code:

Sub MBox()
Dim Config as Integer
Dim Ans As Integer
Config = vbYesNo + vbQuestion + vbDefaultButton2
Ans = MsgBox("Are you sure the correct Axiom reports are open in
Excel?",
Config)
If Ans = vbYes Then RunReport
Then I have the report code
End Sub

Everything is just fine and dandy - the box pops up with yes and no -
but
when I click Yes nothing happens. When I click No, the report runs for
however many times I clicked Yes. It is very strange. Any suggestions
on
how
to get this to work properly?

Charles







[email protected]

Msg Box VBA Issue
 
What is the code/sub routine for RunReport ?

On Jan 26, 10:30 am, CJLuke wrote:
I am using the following code:

Sub MBox()
Dim Config as Integer
Dim Ans As Integer
Config = vbYesNo + vbQuestion + vbDefaultButton2
Ans = MsgBox("Are you sure the correct Axiom reports are open in Excel?",
Config)
If Ans = vbYes Then RunReport
Then I have the report code
End Sub

Everything is just fine and dandy - the box pops up with yes and no - but
when I click Yes nothing happens. When I click No, the report runs for
however many times I clicked Yes. It is very strange. Any suggestions on how
to get this to work properly?

Charles



Susan

Msg Box VBA Issue
 
charles......
i have had horrible trouble using msgboxes in this configuration.
somebody here taught me to use them in an "if" statement, & i find (for
me) they work much better.
i would ammend your code as follows:

Sub MBox()
If MsgBox("Are you sure the correct Axiom reports are open in Excel?" _
, vbYesNo + vbQuestion) = vbYes Then
run report
end if
' Then I have the report code
End Sub


watch the google line wrapping - that underscore belongs up with the
previous line.
susan



On Jan 25, 4:30 pm, CJLuke wrote:
I am using the following code:

Sub MBox()
Dim Config as Integer
Dim Ans As Integer
Config = vbYesNo + vbQuestion + vbDefaultButton2
Ans = MsgBox("Are you sure the correct Axiom reports are open in Excel?",
Config)
If Ans = vbYes Then RunReport
Then I have the report code
End Sub

Everything is just fine and dandy - the box pops up with yes and no - but
when I click Yes nothing happens. When I click No, the report runs for
however many times I clicked Yes. It is very strange. Any suggestions on how
to get this to work properly?

Charles



CJLuke

Msg Box VBA Issue
 
Ok, using the IF statement works a lot better and at least the report runs
when I hit yes. However, when I hit no the report continues to run. How do I
just get the report to stop running when I hit no and to run when I hit yes.

Charles

"Susan" wrote:

charles......
i have had horrible trouble using msgboxes in this configuration.
somebody here taught me to use them in an "if" statement, & i find (for
me) they work much better.
i would ammend your code as follows:

Sub MBox()
If MsgBox("Are you sure the correct Axiom reports are open in Excel?" _
, vbYesNo + vbQuestion) = vbYes Then
run report
end if
' Then I have the report code
End Sub


watch the google line wrapping - that underscore belongs up with the
previous line.
susan



On Jan 25, 4:30 pm, CJLuke wrote:
I am using the following code:

Sub MBox()
Dim Config as Integer
Dim Ans As Integer
Config = vbYesNo + vbQuestion + vbDefaultButton2
Ans = MsgBox("Are you sure the correct Axiom reports are open in Excel?",
Config)
If Ans = vbYes Then RunReport
Then I have the report code
End Sub

Everything is just fine and dandy - the box pops up with yes and no - but
when I click Yes nothing happens. When I click No, the report runs for
however many times I clicked Yes. It is very strange. Any suggestions on how
to get this to work properly?

Charles




Susan

Msg Box VBA Issue
 
If MsgBox("Are you sure the correct Axiom reports are open in Excel?" _
, vbYesNo + vbQuestion) = vbYes Then
run report

else
exit sub 'or whatever else you want it to do
end if



On Jan 26, 12:48 pm, CJLuke wrote:
Ok, using the IF statement works a lot better and at least the report runs
when I hit yes. However, when I hit no the report continues to run. How do I
just get the report to stop running when I hit no and to run when I hit yes.

Charles



"Susan" wrote:
charles......
i have had horrible trouble using msgboxes in this configuration.
somebody here taught me to use them in an "if" statement, & i find (for
me) they work much better.
i would ammend your code as follows:


Sub MBox()
If MsgBox("Are you sure the correct Axiom reports are open in Excel?" _
, vbYesNo + vbQuestion) = vbYes Then
run report
end if
' Then I have the report code
End Sub


watch the google line wrapping - that underscore belongs up with the
previous line.
susan


On Jan 25, 4:30 pm, CJLuke wrote:
I am using the following code:


Sub MBox()
Dim Config as Integer
Dim Ans As Integer
Config = vbYesNo + vbQuestion + vbDefaultButton2
Ans = MsgBox("Are you sure the correct Axiom reports are open in Excel?",
Config)
If Ans = vbYes Then RunReport
Then I have the report code
End Sub


Everything is just fine and dandy - the box pops up with yes and no - but
when I click Yes nothing happens. When I click No, the report runs for
however many times I clicked Yes. It is very strange. Any suggestions on how
to get this to work properly?


Charles- Hide quoted text -- Show quoted text -



CJLuke

Msg Box VBA Issue
 
Got it! Thanks a ton...

"Susan" wrote:

If MsgBox("Are you sure the correct Axiom reports are open in Excel?" _
, vbYesNo + vbQuestion) = vbYes Then
run report

else
exit sub 'or whatever else you want it to do
end if



On Jan 26, 12:48 pm, CJLuke wrote:
Ok, using the IF statement works a lot better and at least the report runs
when I hit yes. However, when I hit no the report continues to run. How do I
just get the report to stop running when I hit no and to run when I hit yes.

Charles



"Susan" wrote:
charles......
i have had horrible trouble using msgboxes in this configuration.
somebody here taught me to use them in an "if" statement, & i find (for
me) they work much better.
i would ammend your code as follows:


Sub MBox()
If MsgBox("Are you sure the correct Axiom reports are open in Excel?" _
, vbYesNo + vbQuestion) = vbYes Then
run report
end if
' Then I have the report code
End Sub


watch the google line wrapping - that underscore belongs up with the
previous line.
susan


On Jan 25, 4:30 pm, CJLuke wrote:
I am using the following code:


Sub MBox()
Dim Config as Integer
Dim Ans As Integer
Config = vbYesNo + vbQuestion + vbDefaultButton2
Ans = MsgBox("Are you sure the correct Axiom reports are open in Excel?",
Config)
If Ans = vbYes Then RunReport
Then I have the report code
End Sub


Everything is just fine and dandy - the box pops up with yes and no - but
when I click Yes nothing happens. When I click No, the report runs for
however many times I clicked Yes. It is very strange. Any suggestions on how
to get this to work properly?


Charles- Hide quoted text -- Show quoted text -





All times are GMT +1. The time now is 06:36 AM.

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