Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 126
Default Why 2 clicks on a command button

I have an addin which opens a 2nd wbk with 3 Forms buttons on sh1 of the wbk.
Two buttons work as expected. The 3rd requires a second click (not
dbl-click, but two single clicks ) to make it work. The first click causes
the screen to flicker, so it's doing something. The second click fires it
correctly. Why 2 clicks ?

Public Sub ShutdownApplication()

' Ignore any errors during shutdown.
On Error Resume Next
gbShutdownInProgress = True

With Application
.DisplayFormulaBar = True
.Workbooks(gsFILE_RENTAL_APPL).Close False
'Restore the state of the Excel environment
Call RestoreExcelSettings

' If there are no workbooks left open, quit Excel
' Otherwise just close this workbook.
If lCountVisibleWorkbooks() = 0 Then
ThisWorkbook.Saved = True
.Quit
Else
ThisWorkbook.Close False
End If
End With
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default Why 2 clicks on a command button

Have you tried setting a breakpoint in the button click event and stepping
through with the debugger yet? It may be that it really is performing the
event the first time you click the button, but may be breaking out due to an
error.

"cush" wrote:

I have an addin which opens a 2nd wbk with 3 Forms buttons on sh1 of the wbk.
Two buttons work as expected. The 3rd requires a second click (not
dbl-click, but two single clicks ) to make it work. The first click causes
the screen to flicker, so it's doing something. The second click fires it
correctly. Why 2 clicks ?

Public Sub ShutdownApplication()

' Ignore any errors during shutdown.
On Error Resume Next
gbShutdownInProgress = True

With Application
.DisplayFormulaBar = True
.Workbooks(gsFILE_RENTAL_APPL).Close False
'Restore the state of the Excel environment
Call RestoreExcelSettings

' If there are no workbooks left open, quit Excel
' Otherwise just close this workbook.
If lCountVisibleWorkbooks() = 0 Then
ThisWorkbook.Saved = True
.Quit
Else
ThisWorkbook.Close False
End If
End With
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 126
Default Why 2 clicks on a command button

Yes, and I tried replacing
On Error Resume Next
with
Stop

still the first click just flickered the active cell without running the sub.

The 2nd click ran the code to line 1 (Stop)
Stepping through caused no error.

??????????????????

"Charlie" wrote:

Have you tried setting a breakpoint in the button click event and stepping
through with the debugger yet? It may be that it really is performing the
event the first time you click the button, but may be breaking out due to an
error.

"cush" wrote:

I have an addin which opens a 2nd wbk with 3 Forms buttons on sh1 of the wbk.
Two buttons work as expected. The 3rd requires a second click (not
dbl-click, but two single clicks ) to make it work. The first click causes
the screen to flicker, so it's doing something. The second click fires it
correctly. Why 2 clicks ?

Public Sub ShutdownApplication()

' Ignore any errors during shutdown.
On Error Resume Next
gbShutdownInProgress = True

With Application
.DisplayFormulaBar = True
.Workbooks(gsFILE_RENTAL_APPL).Close False
'Restore the state of the Excel environment
Call RestoreExcelSettings

' If there are no workbooks left open, quit Excel
' Otherwise just close this workbook.
If lCountVisibleWorkbooks() = 0 Then
ThisWorkbook.Saved = True
.Quit
Else
ThisWorkbook.Close False
End If
End With
End Sub

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
Count and Reset Button Clicks Arlen Excel Discussion (Misc queries) 3 May 12th 10 04:33 AM
command button add another command Wanna Learn Excel Discussion (Misc queries) 5 December 7th 08 11:42 PM
Open an Outlook folder when a user clicks on a command button ... Rob Keel Excel Discussion (Misc queries) 2 August 1st 05 08:23 AM
Command Button vs Control Button RGibson Excel Programming 1 October 14th 03 02:24 AM
Command Button vs Form Button T K Excel Programming 4 August 26th 03 07:26 PM


All times are GMT +1. The time now is 09:58 PM.

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

About Us

"It's about Microsoft Excel"