Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Character code for en space and em space

Posted on 2011-03-24
4
Medium Priority
?
957 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
The viewer will learn how to make their project stand out over others by learning how to change colors and shapes, add spaces, change directions, and add bullets to their charts.
In a previous video Micro Tutorial here at Experts Exchange (http://www.experts-exchange.com/videos/1358/How-to-get-a-free-trial-of-Office-365-with-the-Office-2016-desktop-applications.html), I explained how to get a free, one-month trial of Office …
Suggested Courses

721 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