#1   Report Post  
Posted to microsoft.public.word.newusers
Sul@MS Sul@MS is offline
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.word.newusers
Greg Maxey[_2_] Greg Maxey[_2_] is offline
external usenet poster
 
Posts: 668
Default 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   Report Post  
Posted to microsoft.public.word.newusers
Win7 Win7 is offline
external usenet poster
 
Posts: 1
Default 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

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
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. Sean Steele Mailmerge 4 October 3rd 07 07:22 PM
When click enter, I only get single space, want double space Michael_Randall Page Layout 2 July 5th 07 12:50 PM
too much space between lines in a list (single space for page setu 01anne Microsoft Word Help 2 April 25th 07 09:00 PM
Go from single space to double space lines on a WORD doc Arthur Microsoft Word Help 1 August 13th 06 08:09 PM
Replace Single Space with Double Space John R. Baker New Users 3 December 11th 04 05:15 AM


All times are GMT +1. The time now is 09:30 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"