Solved

Character code for en space and em space

Posted on 2011-03-24
4
782 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 125 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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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) …
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …

747 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now