View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Frank Kabel Frank Kabel is offline
external usenet poster
 
Posts: 3,885
Default Validation List Definition Fails for Some Regional Settings

Hi
works for me (Excel 2003 / German version). I only get the #1004 error
if a validation exist before. You may change your code to
With rngReportRow(1, 7).Resize(1, 45).Validation
.Delete
.Add Type:=xlValidateList,
AlertStyle:=xlValidAlertStop,Operator:=xlBetween, _
Formula1:="=offset($P$1198,1,0,$P$1198,1)"

HTH
Frank

wrote:
We are using VBA to define an Excel validation list using the code
extract shown below:

With rngReportRow(1, 7).Resize(1, 45).Validation
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop,
Operator:=xlBetween, _
Formula1:="=offset($P$1198,1,0,$P$1198,1)"

This code works fine for some Regional Settings on the computer
running the VBA code. (E.g. "English (United States)", "English
(United Kingdom)", "Japanese".) But when the Regional settings are
either "Dutch (Netherlands)" or "German (Germany)" the Add method
fails with an error #1004 (Application-defined or object-defined
error).

To add to the curious nature of this problem, it disappears if a
breakpoint is set on the Add method line. This might suggest a
timing problem, however we have tried a number of different techniues
to introduce an artificial delay prior to the Add method without
success. (E.g. DoEvents, Wait, Loop, MsgBox.)

I would greatly appreciate any suggestions for a solution or
workaround to this problem. For reference, this problem was observed
on systems running Excel 2000 (9.0.6926 SP-3) on Windows 2000
(5.00.2195 Service Pack 4).

Thanks for any help that you can offer.

Cheers,
Randy MacDonald