tabs and spaces

G

Guest

I know how to replace all tabs with a general "something else"
edit--replace--more--special character--tab character...but how can I inform
Word that I want to insert 4 spaces when I tab???
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?TGl0dGxlX0ppbW15?=,
I know how to replace all tabs with a general "something else"
edit--replace--more--special character--tab character...but how can I inform
Word that I want to insert 4 spaces when I tab???
You'd need to use a macro for this that remaps the TAB key. Here's some sample
code that makes the change in the current document, only. The first "Sub"
changes the Tab key mapping. The second "Sub" is the macro that will now be
called by pressing the TAB key (inserts the four spaces). The third macro will
turn off the Tab key mapping, restoring the original behavior.

If you don't know how what to do with these macros, you'll find a tutorial on
the word.mvps.org site on how to use macros people give you over the Internet.

Sub TabKeyInsertsSpaces()
Dim kb As Word.KeyBinding
Dim doc As Word.Document

Set doc = ActiveDocument
Application.CustomizationContext = doc
Set kb = Application.KeyBindings.Add( _
KeyCategory:=wdKeyCategoryMacro, _
Command:="TypeSpaces", _
KeyCode:=BuildKeyCode(wdKeyTab))
End Sub

Sub TypeSpaces()
Selection.Text = " "
Selection.Collapse wdCollapseEnd
End Sub

Sub ReleaseTabKey()
Dim doc As Word.Document

Set doc = ActiveDocument
CustomizationContext = doc
FindKey(BuildKeyCode(wdKeyTab)).Clear
End Sub


Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top