Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Excel Invalid Parameter
Message
 
To
30/04/2013 19:55:43
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Environment versions
Visual FoxPro:
VFP 8 SP1
Miscellaneous
Thread ID:
01572078
Message ID:
01572590
Views:
36
>>>In a program that has been working successfully for a long time we are suddenly getting an error message from the following line of code
>>>
>>>oXL.Application.WorkBooks.Open(lcFile)
>>>oXL.Cells.Select
>>>oXL.Selection.autofilter
>>>oSelection = oXL.Selection
>>>oSelection.FormatConditions.Add(2,[=],[=MOD($G1,2)])
>>>
>>>The last line errors with the following message
>>>
>>>MessageOLE error code 0x80070057: The parameter is incorrect.
>>>
>>>We are using Excel 2003
>>>
>>>I tried substituting the value for xlEqual instead of the equal sign but got the same message
>>>
>>>Can anybody shed some light on what might be causing this and what corrective action I can take?
>>>
>>>Thanks to all...........Rich
>>
>>
>>I do not know all the details of your excel file. So, as a shot in the dark, try:
>>
>>
oXL.Selection.FormatConditions.Delete
>>oXL.Selection.FormatConditions.Add(2,[=],[=MOD($G1,2)])
>>
>>Good Luck
>
>Sorry for the delay in acknowledging your answer.
>
>Unfortunately, it didn't resolve the problem.
>
>Strangely enough, the exact same line of code still works in another application and I can't find any differences that might cause this error.
>
>I appreciate the effort. Ah well.........back to the drawing board!!!!!
>

Just in case, and from Excel VBA Help on FormatConditions.Add:

*---------------------------------------------------------------------
expression.Add(Type, Operator, Formula1, Formula2)
expression Required. An expression that returns a FormatConditions object.
Type Required XlFormatConditionType. Specifies whether the conditional format is based on a cell value or an expression.

XlFormatConditionType can be one of these XlFormatConditionType constants.
xlCellValue=1 The conditional format is based on a cell value.
xlExpression =2 The conditional format is based on an expression.

Operator Optional Variant. The conditional format operator. Can be one of the following XlFormatConditionOperator constants: xlBetween, xlEqual, xlGreater, xlGreaterEqual, xlLess, xlLessEqual, xlNotBetween, or xlNotEqual.

If Type is xlExpression, the Operator argument is ignored.
*-----------------------------------

So, it looks like in your case operator [=] is ignored.
Previous
Reply
Map
View

Click here to load this message in the networking platform