Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Character code for en space and em space

Posted on 2011-03-24
4
Medium Priority
?
995 Views
Last Modified: 2012-05-11
Does anyone know the character codes for an en space and an em space in VBA for Word?
0
Comment
Question by:Fi69
  • 2
  • 2
4 Comments
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 35206654
I don't believe that there is on, since with proportional fonts, it would be rather redundant.
You could use a couple of spaces for the n, and three or four for the m space, but it wouldn't be precise, and would depend on the font and the letter case.

If you need character to align vertically, there are other ways of achieving it, including tabs and fixed-width fonts such as Courier New.
0
 

Author Comment

by:Fi69
ID: 35211328
Okay, thanks Graham. No I wanted to achieve that gap without using spaces, just separating telephone and fax that appear on the one line. I'll just use two spaces. I still use them often via Insert > Symbol and hoped to do via code.
0
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 500 total points
ID: 35211560
Sorry Fi,

If you can find the symbol that way, then I was wrong. I have only ever been able to find a normal space and a non-break space, but I was looking in the wrong place.

Try this:


Sub InsertSpaces(rng As Range)
    rng.InsertAfter ChrW(8195) 'm space
    rng.InsertAfter ChrW(8194) 'n space
End Sub

Open in new window

0
 

Author Closing Comment

by:Fi69
ID: 35211591
Perfect - thank you!
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I would like to show you some basics you can do with Mailings in MS Word. It´s quite handy feature you can use for creating envelopes, labels, personalized letters etc. First question could be what is this feature good for? Mailing can really he…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
In this video, we show how to convert an image-only PDF file into a PDF Searchable Image file, that is, a file with both the image (typically from scanning) and text, which is created in an automated fashion with Optical Character Recognition (OCR) …
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …
Suggested Courses

824 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question