> I might be not getting what you want
> this is what your code gives:
>
> AAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBB222222
> CCCCCCCCCCCCCCCCCCC111111DDDDDDDDDDDDDDDDDD
>
> I understood you wanted this
>
> AAAAAAAAAAAAAAAAAAAA111111BBBBBBBBBBBBBBBBBB
> 222222CCCCCCCCCCCCC333333  
> etc


Whoops!  There was an error in my code.

What I should have gotten was this:
AAAAAAAAAAAAAAAAAAAA111111BBBBBBBBBBBBBBBBB222222CCCCCCCCCCCCCCCCCCC111111DD
DDDDDDDDDDDDDDDD

All that should be replaced is the second occurrence of the string "111111".


I have modified the code as seen below.  It seems to work fine.

I saw a couple responses to this, and this seems to be the way to go, as far
as I can tell.

What I'm really doing is opening an XML Excel spreadsheet file as text and
selectively adding/editing page setups.  Having written that sentence,
perhaps dealing with it as XML might be better.  Though I'm totally clueless
about XML...

Thanks for everyone's help.


  Dim aString As String
  Dim arString() As String
  dim theFinalString as String
  Dim i as Integer
  
  aString =
"AAAAAAAAAAAAAAAAAAAA111111BBBBBBBBBBBBBBBBB111111CCCCCCCCCCCCCCCCCCC111111D
DDDDDDDDDDDDDDDDD"
  arString = Split(aString,"111111")
  
  for i = 0 to UBound(arString)
    If i = 1 then
      theFinalString = theFinalString + arString(i) + "222222"
    ElseIf i <> 1 and i <> UBound(arString) then
      theFinalString = theFinalString + arString(i) + "111111"
    Else
      theFinalString = theFinalString + arString(i)
    End If
  Next
  
  MsgBox theFinalString


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to