PC Review


Reply
Thread Tools Rate Thread

Automate insert text

 
 
Diogo
Guest
Posts: n/a
 
      23rd Jun 2008
I've a unic string of 2000 characters, how can I automate the procedure of
inserting a "\" every three characters?

string as is =
Aa0Aa1Aa2Aa3Aa4Aa5Aa6Aa7Aa8Aa9Ab0Ab1Ab2Ab3Ab4Ab5Ab6Ab7Ab8Ab9Ac0Ac1Ac2Ac3Ac4Ac5Ac6Ac7Ac8Ac9Ad0Ad1Ad2Ad3Ad4Ad5Ad6Ad7Ad8Ad9Ae0Ae1Ae2Ae3

string to be = Aa0\Aa1\Aa2\Aa3\Aa4\Aa5\Aa6\Aa7\.....
 
Reply With Quote
 
 
 
 
Alex Dybenko
Guest
Posts: n/a
 
      23rd Jun 2008
Hi,
something like this:


for i = 1 to len(strOriginal) step 3
strResult= strResult & "\" & mid(strOriginal, i, 3)
next i


--
Best regards,
___________
Alex Dybenko (MVP)
http://accessblog.net
http://www.PointLtd.com


"Diogo" <(E-Mail Removed)> wrote in message
newsC54BFF4-7102-441E-9F84-(E-Mail Removed)...
> I've a unic string of 2000 characters, how can I automate the procedure of
> inserting a "\" every three characters?
>
> string as is =
> Aa0Aa1Aa2Aa3Aa4Aa5Aa6Aa7Aa8Aa9Ab0Ab1Ab2Ab3Ab4Ab5Ab6Ab7Ab8Ab9Ac0Ac1Ac2Ac3Ac4Ac5Ac6Ac7Ac8Ac9Ad0Ad1Ad2Ad3Ad4Ad5Ad6Ad7Ad8Ad9Ae0Ae1Ae2Ae3
>
> string to be = Aa0\Aa1\Aa2\Aa3\Aa4\Aa5\Aa6\Aa7\.....


 
Reply With Quote
 
Brendan Reynolds
Guest
Posts: n/a
 
      23rd Jun 2008
"Diogo" <(E-Mail Removed)> wrote in message
newsC54BFF4-7102-441E-9F84-(E-Mail Removed)...
> I've a unic string of 2000 characters, how can I automate the procedure of
> inserting a "\" every three characters?
>
> string as is =
> Aa0Aa1Aa2Aa3Aa4Aa5Aa6Aa7Aa8Aa9Ab0Ab1Ab2Ab3Ab4Ab5Ab6Ab7Ab8Ab9Ac0Ac1Ac2Ac3Ac4Ac5Ac6Ac7Ac8Ac9Ad0Ad1Ad2Ad3Ad4Ad5Ad6Ad7Ad8Ad9Ae0Ae1Ae2Ae3
>
> string to be = Aa0\Aa1\Aa2\Aa3\Aa4\Aa5\Aa6\Aa7\.....



Public Sub InsertSlashes()

Const strcTest As String =
"Aa0Aa1Aa2Aa3Aa4Aa5Aa6Aa7Aa8Aa9Ab0Ab1Ab2Ab3Ab4Ab5Ab6Ab7Ab8Ab9Ac0Ac1Ac2Ac3Ac4Ac5Ac6Ac7Ac8Ac9Ad0Ad1Ad2Ad3Ad4Ad5Ad6Ad7Ad8Ad9Ae0Ae1Ae2Ae3"

Dim strWork As String
Dim lngLoop As Long

For lngLoop = 1 To Len(strcTest) Step 3
strWork = strWork & Mid$(strcTest, lngLoop, 3) & "/"
Next lngLoop
strWork = Left$(strWork, Len(strWork) - 1)

Debug.Print strWork

End Sub

Result in the Immediate window ...

insertslashes
Aa0/Aa1/Aa2/Aa3/Aa4/Aa5/Aa6/Aa7/Aa8/Aa9/Ab0/Ab1/Ab2/Ab3/Ab4/Ab5/Ab6/Ab7/Ab8/Ab9/Ac0/Ac1/Ac2/Ac3/Ac4/Ac5/Ac6/Ac7/Ac8/Ac9/Ad0/Ad1/Ad2/Ad3/Ad4/Ad5/Ad6/Ad7/Ad8/Ad9/Ae0/Ae1/Ae2/Ae3

--
Brendan Reynolds

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Automate Insert Worksheet & Name Benjamin Microsoft Excel Misc 2 25th Apr 2008 09:09 PM
automate Outlook..insert signiture =?Utf-8?B?U0Ft?= Microsoft Access VBA Modules 5 15th Aug 2007 10:23 PM
automate row insert to archive =?Utf-8?B?dGZyZW50eg==?= Microsoft Excel Worksheet Functions 9 25th Jan 2007 01:12 PM
Re: automate cut/insert tasks JE McGimpsey Microsoft Excel Programming 0 16th Jan 2007 11:20 PM
Automate insert data Anupam Microsoft Excel Discussion 1 20th May 2004 12:58 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:59 AM.