Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
replace VBA run-time error message with custom message | Excel Programming | |||
Replace Excel Message w/Custom Message | Excel Programming | |||
Intercept/replace standard 'cell protected' message with my own message? | Excel Programming | |||
Opening an attachment of a message that has a message as attachmen | Excel Programming | |||
Displaying a message in a message box without requiring user to click anything to proceed | Excel Programming |