Thread: Quote constant?
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Walter Briscoe Walter Briscoe is offline
external usenet poster
 
Posts: 279
Default Quote constant?

In message of Sat, 13
Apr 2013 09:22:32 in microsoft.public.excel.programming, Charlotte E.
writes
Hi,


I would like to make a vbQuote constant, like:

Const vbQuote As String = Chr(34)

...so that I can use vbQuote when I need to insert a " in a string,
instead of Chr(34).

But when I do the above code line to define the constant, I get an
error saying that a constant expression is needed.

But, in my eyes that is a constant expression???


It may produce a fixed result, but that result is not, technically, a
constant.

So, how do I make a vbQuote constants?


Thanks,

CE


This:
vbQuote = ["]


is the result of running foo:

Option Explicit
Const vbQuote As String = """"

Public Sub foo()
Debug.Print "vbQuote = [" & vbQuote & "]"
End Sub
--
Walter Briscoe