Solved

Character code for en space and em space

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

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

Suggested Solutions

Nice table. Huge mess. Maybe this was something you created way back before you figured out tabs or a document you received from someone else. Either way, using the spacebar to separate the columns resulted in a mess. Trying to convert text to t…
Introduction This tutorial provides instructions on how to properly format your Word document using the inbuilt tools provided. The benefits of using these tools means your documents are more accessible and easily portable to other applications an…
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.
Office 365 is currently available in five editions. Three of them are for business use: Office 365 Business Essentials, Office 365 Business, and Office 365 Business Premium. Two of them are for home/personal use: Office 365 Home and Office 365 Perso…

734 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