+ Reply to Thread
Results 1 to 4 of 4

How to use CHR(34) a a constant

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    01-25-2011
    Location
    Virginia
    MS-Off Ver
    Excel 2016
    Posts
    166

    How to use CHR(34) a a constant

    Is it possible to use CHR(34) (a singe quote mark) as a constant? I have tried:
    Private Const Units as string = CHR(34)
    Private Const Units as string = "
    Private Const Units as string = """
    None of those worked! FYI I am using CHR(34) as a representation for inches. I would like to make it so if the user prefered metric the only line he would have to change would be the constant line.

    Thanx in advance,

    Tom
    Last edited by tom.hogan; 02-20-2012 at 09:25 PM.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: How to use CHR(34) a a constant

    You can't use a function to define a constant.

    Private Const Units as String = """"
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Contributor
    Join Date
    01-25-2011
    Location
    Virginia
    MS-Off Ver
    Excel 2016
    Posts
    166

    Re: How to use CHR(34) a a constant

    Shg,

    Wow, awesome - I would have thought """" would give you "" but it gives just one " like I wanted.

    Thanks,

    Tom

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: How to use CHR(34) a a constant

    A literal quote always has an even number of quotation marks. Each pair of interior marks adds a single qoute to the string.
    Last edited by shg; 02-22-2012 at 01:35 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1