Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.newusers
|
|||
|
|||
space macro
I have this one (thanks to someone)
Sub InsertSpaces() Dim sIn As String, sOut As String Dim i As Integer sIn = Selection.Text For i = 1 To Len(sIn) sOut = sOut & Mid$(sIn, i, 1) & " " Next Selection.Text = sOut End Sub the above inserts a space between letters How to I edit the above to use a dot "." instead of a space ? example; this is a test becomes t.h.i.s i.s. a. t.e.s.t tia -- Dual Boot WinXP Pro SP3 with Windows 7 |
#2
Posted to microsoft.public.word.newusers
|
|||
|
|||
space macro
You would replace & " "
witn & "." You could also adapt the code to allow user to select the character: Sub InsertCharacter() Dim sIn As String Dim sOut As String Dim i As Long Dim sChar As String sChar = InputBox("Enter the character to insert", "Character", ".") sIn = Selection.Text For i = 1 To Len(sIn) sOut = sOut & Mid$(sIn, i, 1) & sChar Next Selection.Text = sOut End Sub Sul@MS wrote: I have this one (thanks to someone) Sub InsertSpaces() Dim sIn As String, sOut As String Dim i As Integer sIn = Selection.Text For i = 1 To Len(sIn) sOut = sOut & Mid$(sIn, i, 1) & " " Next Selection.Text = sOut End Sub the above inserts a space between letters How to I edit the above to use a dot "." instead of a space ? example; this is a test becomes t.h.i.s i.s. a. t.e.s.t tia -- Greg Maxey - Word MVP My web site http://gregmaxey.mvps.org Word MVP web site http://word.mvps.org |
#3
Posted to microsoft.public.word.newusers
|
|||
|
|||
space macro
thanks for the tip
"Greg Maxey" wrote in message ... You would replace & " " witn & "." You could also adapt the code to allow user to select the character: Sub InsertCharacter() Dim sIn As String Dim sOut As String Dim i As Long Dim sChar As String sChar = InputBox("Enter the character to insert", "Character", ".") sIn = Selection.Text For i = 1 To Len(sIn) sOut = sOut & Mid$(sIn, i, 1) & sChar Next Selection.Text = sOut End Sub Sul@MS wrote: I have this one (thanks to someone) Sub InsertSpaces() Dim sIn As String, sOut As String Dim i As Integer sIn = Selection.Text For i = 1 To Len(sIn) sOut = sOut & Mid$(sIn, i, 1) & " " Next Selection.Text = sOut End Sub the above inserts a space between letters How to I edit the above to use a dot "." instead of a space ? example; this is a test becomes t.h.i.s i.s. a. t.e.s.t tia -- Greg Maxey - Word MVP My web site http://gregmaxey.mvps.org Word MVP web site http://word.mvps.org |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
FULLNAME merge field: how do I get it to just show the first name, i.e. everything before the space and nothing after the space. | Mailmerge | |||
When click enter, I only get single space, want double space | Page Layout | |||
too much space between lines in a list (single space for page setu | Microsoft Word Help | |||
Go from single space to double space lines on a WORD doc | Microsoft Word Help | |||
Replace Single Space with Double Space | New Users |