On 5 jan, 17:40, ralph <nt_consultin...@yahoo.net> wrote:
> On Thu, 5 Jan 2012 00:44:44 -0800 (PST), avi <avi...@bezeqint.net.il>
> wrote:
>
>
>
>
>
>
>
>
>
> >Hello,
>
> >I have procedure that reads strings from a file
> >LayerC = Chr(34) & Layer & Chr(34)
> >Then Evaluate a count
>
> > CountIn = _
> > xlApp.Evaluate("SUMPRODUCT((" &
> >MainDataRange.Address & "=" & TvahC & ")*(" & RangeLayers.Address &
> >"=" & LayerC & "))")
>
> >The problem is if the variable Layer contains double quotes (For
> >Example N"Y) , the new variable LayerC is now "N"Y", which the 2nd
> >statement does not accept
>
> >Any idea?
>
> As Jason pointed out you can "escape" the embedded quotes in "Layer".
>
> If you add a double quote to the quote in the string it will mark the
> quote as a 'literal' double quote and not be parsed as an argument
> delimiter.
>
> This is a problem that shows up frequently whenever an argument or
> value contains characters that are also used as delimiters. (Double
> quotes, single quotes, occasionally spaces, tabs, etc. - with such
> things as command line processors, search/find routines, argument
> lists, etc.)
>
> I suggest you take a look at the many articles online that address
> these kinds of problems and the various ways to manage them, as you
> will run into the issue again and again in your programming career.
> <bg>
>
> -ralph
It works very well!
Thanks for the wise advice also
Avi