View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Susan Susan is offline
external usenet poster
 
Posts: 1,117
Default 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 -