ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Combobox change property (https://www.excelbanter.com/excel-programming/318073-combobox-change-property.html)

SASMan

Combobox change property
 
I have a code attached to a "change" event that executes after an unrelated
pivot table refresh button. Since it isn't expected to execute at that time,
I get error messages and failures. I'm a SAS programmer and not very
familiar with VB. Naturally, there's an unrealistic deadline and I'm
pleading for help.

Here's the error:
Run-time error '1004'
Unable to get PivotFields property of the PivotTable class.

On debug, I am taken to a sub routine that is called from a change event
from a list box on the same page that holds the button which was pressed (to
generate the error). Also, when the change control is activated directly,
there is no error and the code works fine.

I'd send the whole thing, but I think it would be too big (due to the
underlying databases)


Harald Staff

Combobox change property
 
Hi

Either have a global variable, like

Public AutoClick as Boolean

set it to true when you want to indicate that code is managing everything,
so do nothing, dear events. In top of the click event then

If AutoClick = True then Exit Sub

Or, when unrealistic deadlines seem too close, put

On Error Resume Next

just everywhere. No crashes ever again, no error messages, some things works
perfect and some simply don't.

HTH. Best wishes Harald

"SASMan" skrev i melding
...
I have a code attached to a "change" event that executes after an

unrelated
pivot table refresh button. Since it isn't expected to execute at that

time,
I get error messages and failures. I'm a SAS programmer and not very
familiar with VB. Naturally, there's an unrealistic deadline and I'm
pleading for help.

Here's the error:
Run-time error '1004'
Unable to get PivotFields property of the PivotTable class.

On debug, I am taken to a sub routine that is called from a change event
from a list box on the same page that holds the button which was pressed

(to
generate the error). Also, when the change control is activated directly,
there is no error and the code works fine.

I'd send the whole thing, but I think it would be too big (due to the
underlying databases)





All times are GMT +1. The time now is 03:38 PM.

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