[macro] Global constant for special character

Hi,

Recently I learned how to create global constants. Great! However … there is a small problem.

Some special characters in texts need to be created by using the chr() function. For example I use chr(8220) to create double left quotes and chr(8221) to create double right quotes. Now if I want to quote something in a text I do it like this:

MsgBox("Hello " & chr(8220) & "John" & chr(8221) & ".")

This is not very readable, so I wanted to use constants:

REM Top op Document
Global Const LQ = chr(8220)
Global Const RQ = chr(8221)

REM Somewhere else in the document
MsgBox("Hello " & LQ & "John" & RQ & ".")

However, this is not working because assigning the chr() function to a constant is not accepted and results in an error. Is there another way to globally assign special characters? Help needed …

Hallo

 Global Const LQ = "“"
 Global Const RQ = "”"

Thank you very much Karolus!

Can I also assign a linebreak that way? Currently I use chr(13) for a line break (new line). I would like to assign that to a constant as well. Is that possible?

if change to serious programming language, you will never have thus silly problems.

True, but it doesn’t answer my question :wink:

Can I somehow assign these linebreak to a constant or variable which I can use in all macro’s (subs)?

Something like this:

Global Const BREAK = chr(13) & chr(13)

Can it somehow be done?

It answer your question because nobody force you to stumble with basic!