Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 64
Default Message Box - Yes/No

Hi, I am running Excel 2003 and have created a Mssg Box for a workbook that
requires a Yes / No response. For some reason, the 'Yes' response needs to
be 'double clicked' to activiate it. Can someone tell me how, or if it can
be changed to 'single click'. The code I have is:

Sub ClearDoc()

Dim response As Long
answer = MsgBox("Do you have another Agency Billing to complete ?",
vbYesNo + vbQuestion)

If answer = vbYes Then

Sheets("Input").Select
Range("A6:h35").Select
Selection.ClearContents
Range("A6").Select

Else

Sheets("Input").Select
Range("A6").Select

MsgBox "Costs have been recorded. This file will now close", vbInformation

Application.ScreenUpdating = True
ActiveWorkbook.Close SaveChanges:=False

End If
End Sub

Thanks
--
Linda
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Message Box - Yes/No

If you slow down your mouse actions, does it work ok?

I'm guessing that you're just too quick with the first click.

mathel wrote:

Hi, I am running Excel 2003 and have created a Mssg Box for a workbook that
requires a Yes / No response. For some reason, the 'Yes' response needs to
be 'double clicked' to activiate it. Can someone tell me how, or if it can
be changed to 'single click'. The code I have is:

Sub ClearDoc()

Dim response As Long
answer = MsgBox("Do you have another Agency Billing to complete ?",
vbYesNo + vbQuestion)

If answer = vbYes Then

Sheets("Input").Select
Range("A6:h35").Select
Selection.ClearContents
Range("A6").Select

Else

Sheets("Input").Select
Range("A6").Select

MsgBox "Costs have been recorded. This file will now close", vbInformation

Application.ScreenUpdating = True
ActiveWorkbook.Close SaveChanges:=False

End If
End Sub

Thanks
--
Linda


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Message Box - Yes/No

Hi,

There is nothing in the code that would require a double click but you could
try this simplified version. Note the code still selects A6 but unless you
have a particular reason for doing so i doubt it is necessary.

Sub ClearDoc()
answer = MsgBox("Do you have another Agency Billing to complete ?", vbYesNo
+ vbQuestion)
If answer = vbYes Then
Application.EnableEvents = False
Sheets("Input").Range("A6:h35").ClearContents
Application.EnableEvents = True
Sheets("Input").Range("A6").Select
Else
Sheets("Input").Range("A6").Select
MsgBox "Costs have been recorded. This file will now close", vbInformation
ActiveWorkbook.Close SaveChanges:=False
End If
End Sub

Mike

"mathel" wrote:

Hi, I am running Excel 2003 and have created a Mssg Box for a workbook that
requires a Yes / No response. For some reason, the 'Yes' response needs to
be 'double clicked' to activiate it. Can someone tell me how, or if it can
be changed to 'single click'. The code I have is:

Sub ClearDoc()

Dim response As Long
answer = MsgBox("Do you have another Agency Billing to complete ?",
vbYesNo + vbQuestion)

If answer = vbYes Then

Sheets("Input").Select
Range("A6:h35").Select
Selection.ClearContents
Range("A6").Select

Else

Sheets("Input").Select
Range("A6").Select

MsgBox "Costs have been recorded. This file will now close", vbInformation

Application.ScreenUpdating = True
ActiveWorkbook.Close SaveChanges:=False

End If
End Sub

Thanks
--
Linda

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default Message Box - Yes/No

another approach you may want to consider:

Sub ClearDoc()
Dim ClearRange As Range

With Worksheets("Input")

.Activate

Set ClearRange = .Range("A6:H35")

.Range("A6").Select

End With

answer = MsgBox("Do you have another Agency Billing to complete ?", _
36, "Agency Billing")

If answer = 6 Then

Application.EnableEvents = False

ClearRange.ClearContents

Application.EnableEvents = True

Else

msg = MsgBox("Costs have been recorded. This file will now close", _
64, "Agency Billing")

ThisWorkbook.Close SaveChanges:=False

End If

End Sub

--
jb


"mathel" wrote:

Hi, I am running Excel 2003 and have created a Mssg Box for a workbook that
requires a Yes / No response. For some reason, the 'Yes' response needs to
be 'double clicked' to activiate it. Can someone tell me how, or if it can
be changed to 'single click'. The code I have is:

Sub ClearDoc()

Dim response As Long
answer = MsgBox("Do you have another Agency Billing to complete ?",
vbYesNo + vbQuestion)

If answer = vbYes Then

Sheets("Input").Select
Range("A6:h35").Select
Selection.ClearContents
Range("A6").Select

Else

Sheets("Input").Select
Range("A6").Select

MsgBox "Costs have been recorded. This file will now close", vbInformation

Application.ScreenUpdating = True
ActiveWorkbook.Close SaveChanges:=False

End If
End Sub

Thanks
--
Linda

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 64
Default Message Box - Yes/No

I tried slowing mouse action, double click on 'Yes' is still required. The
'No' needs single click only. I had actually tried UserForm before going
with the Message Box and had the same problem with the double click on the
'Yes'.
--
Linda


"Dave Peterson" wrote:

If you slow down your mouse actions, does it work ok?

I'm guessing that you're just too quick with the first click.

mathel wrote:

Hi, I am running Excel 2003 and have created a Mssg Box for a workbook that
requires a Yes / No response. For some reason, the 'Yes' response needs to
be 'double clicked' to activiate it. Can someone tell me how, or if it can
be changed to 'single click'. The code I have is:

Sub ClearDoc()

Dim response As Long
answer = MsgBox("Do you have another Agency Billing to complete ?",
vbYesNo + vbQuestion)

If answer = vbYes Then

Sheets("Input").Select
Range("A6:h35").Select
Selection.ClearContents
Range("A6").Select

Else

Sheets("Input").Select
Range("A6").Select

MsgBox "Costs have been recorded. This file will now close", vbInformation

Application.ScreenUpdating = True
ActiveWorkbook.Close SaveChanges:=False

End If
End Sub

Thanks
--
Linda


--

Dave Peterson



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 64
Default Message Box - Yes/No

I tried what you suggested, the double click is still needed on the Yes
button. No is working fine (single click). Before using the Message Box, I
tried UserForm and had the same problem with the 'Yes' button.
--
Linda


"Mike H" wrote:

Hi,

There is nothing in the code that would require a double click but you could
try this simplified version. Note the code still selects A6 but unless you
have a particular reason for doing so i doubt it is necessary.

Sub ClearDoc()
answer = MsgBox("Do you have another Agency Billing to complete ?", vbYesNo
+ vbQuestion)
If answer = vbYes Then
Application.EnableEvents = False
Sheets("Input").Range("A6:h35").ClearContents
Application.EnableEvents = True
Sheets("Input").Range("A6").Select
Else
Sheets("Input").Range("A6").Select
MsgBox "Costs have been recorded. This file will now close", vbInformation
ActiveWorkbook.Close SaveChanges:=False
End If
End Sub

Mike

"mathel" wrote:

Hi, I am running Excel 2003 and have created a Mssg Box for a workbook that
requires a Yes / No response. For some reason, the 'Yes' response needs to
be 'double clicked' to activiate it. Can someone tell me how, or if it can
be changed to 'single click'. The code I have is:

Sub ClearDoc()

Dim response As Long
answer = MsgBox("Do you have another Agency Billing to complete ?",
vbYesNo + vbQuestion)

If answer = vbYes Then

Sheets("Input").Select
Range("A6:h35").Select
Selection.ClearContents
Range("A6").Select

Else

Sheets("Input").Select
Range("A6").Select

MsgBox "Costs have been recorded. This file will now close", vbInformation

Application.ScreenUpdating = True
ActiveWorkbook.Close SaveChanges:=False

End If
End Sub

Thanks
--
Linda

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 64
Default Message Box - Yes/No

I tried what you wrote in the wb I am using, and still had the same problem
of having to double click the Yes button. I then opened a 'blank' workbook
and ran the same code and have no problems.

Initially, I had set up a UserForm for the code, this was when I first ran
into the 'double click' problem. I tend to suspect the wb is 'contaminated'
and I should recreate it from scratch to.
--
Linda


"john" wrote:

another approach you may want to consider:

Sub ClearDoc()
Dim ClearRange As Range

With Worksheets("Input")

.Activate

Set ClearRange = .Range("A6:H35")

.Range("A6").Select

End With

answer = MsgBox("Do you have another Agency Billing to complete ?", _
36, "Agency Billing")

If answer = 6 Then

Application.EnableEvents = False

ClearRange.ClearContents

Application.EnableEvents = True

Else

msg = MsgBox("Costs have been recorded. This file will now close", _
64, "Agency Billing")

ThisWorkbook.Close SaveChanges:=False

End If

End Sub

--
jb


"mathel" wrote:

Hi, I am running Excel 2003 and have created a Mssg Box for a workbook that
requires a Yes / No response. For some reason, the 'Yes' response needs to
be 'double clicked' to activiate it. Can someone tell me how, or if it can
be changed to 'single click'. The code I have is:

Sub ClearDoc()

Dim response As Long
answer = MsgBox("Do you have another Agency Billing to complete ?",
vbYesNo + vbQuestion)

If answer = vbYes Then

Sheets("Input").Select
Range("A6:h35").Select
Selection.ClearContents
Range("A6").Select

Else

Sheets("Input").Select
Range("A6").Select

MsgBox "Costs have been recorded. This file will now close", vbInformation

Application.ScreenUpdating = True
ActiveWorkbook.Close SaveChanges:=False

End If
End Sub

Thanks
--
Linda

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default Message Box - Yes/No

I have not experienced the problem you have encountered before and without
seeing all you code could not offer any guesses what may be causing your
problem.

Unless others here can offer any further guidance, if transferring to
another workbook solves your problem that probably would be simplest solution
for you.

--
jb


"mathel" wrote:

I tried what you wrote in the wb I am using, and still had the same problem
of having to double click the Yes button. I then opened a 'blank' workbook
and ran the same code and have no problems.

Initially, I had set up a UserForm for the code, this was when I first ran
into the 'double click' problem. I tend to suspect the wb is 'contaminated'
and I should recreate it from scratch to.
--
Linda


"john" wrote:

another approach you may want to consider:

Sub ClearDoc()
Dim ClearRange As Range

With Worksheets("Input")

.Activate

Set ClearRange = .Range("A6:H35")

.Range("A6").Select

End With

answer = MsgBox("Do you have another Agency Billing to complete ?", _
36, "Agency Billing")

If answer = 6 Then

Application.EnableEvents = False

ClearRange.ClearContents

Application.EnableEvents = True

Else

msg = MsgBox("Costs have been recorded. This file will now close", _
64, "Agency Billing")

ThisWorkbook.Close SaveChanges:=False

End If

End Sub

--
jb


"mathel" wrote:

Hi, I am running Excel 2003 and have created a Mssg Box for a workbook that
requires a Yes / No response. For some reason, the 'Yes' response needs to
be 'double clicked' to activiate it. Can someone tell me how, or if it can
be changed to 'single click'. The code I have is:

Sub ClearDoc()

Dim response As Long
answer = MsgBox("Do you have another Agency Billing to complete ?",
vbYesNo + vbQuestion)

If answer = vbYes Then

Sheets("Input").Select
Range("A6:h35").Select
Selection.ClearContents
Range("A6").Select

Else

Sheets("Input").Select
Range("A6").Select

MsgBox "Costs have been recorded. This file will now close", vbInformation

Application.ScreenUpdating = True
ActiveWorkbook.Close SaveChanges:=False

End If
End Sub

Thanks
--
Linda

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default Message Box - Yes/No

Works all OK here, apart from not declaring the answer variable.
Try this:

Sub ClearDoc()

Dim answer As VbMsgBoxResult

DoEvents
answer = MsgBox("Do you have another Agency Billing to complete ?", _
vbYesNo + vbQuestion)


RBS


"mathel" wrote in message
...
Hi, I am running Excel 2003 and have created a Mssg Box for a workbook
that
requires a Yes / No response. For some reason, the 'Yes' response needs
to
be 'double clicked' to activiate it. Can someone tell me how, or if it
can
be changed to 'single click'. The code I have is:

Sub ClearDoc()

Dim response As Long
answer = MsgBox("Do you have another Agency Billing to complete ?",
vbYesNo + vbQuestion)

If answer = vbYes Then

Sheets("Input").Select
Range("A6:h35").Select
Selection.ClearContents
Range("A6").Select

Else

Sheets("Input").Select
Range("A6").Select

MsgBox "Costs have been recorded. This file will now close", vbInformation

Application.ScreenUpdating = True
ActiveWorkbook.Close SaveChanges:=False

End If
End Sub

Thanks
--
Linda


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
replace VBA run-time error message with custom message BEEJAY Excel Programming 13 July 14th 06 03:59 PM
Replace Excel Message w/Custom Message Kevin R Excel Programming 1 May 18th 06 04:13 PM
Intercept/replace standard 'cell protected' message with my own message? KR Excel Programming 3 March 16th 06 02:31 PM
Opening an attachment of a message that has a message as attachmen vetron Excel Programming 0 January 30th 06 06:17 PM
Displaying a message in a message box without requiring user to click anything to proceed Android[_2_] Excel Programming 2 June 25th 04 06:44 PM


All times are GMT +1. The time now is 10:17 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"