Sorry, Still won't run. . Could you please add the prefixes and suffixes
(i.e. Sub...etc... and End Sub, etc... Loop, etc.. so all I have to do is
cut & paste and F11 & F8? I am not a VB guy but want to start learning.
Thanks so much! (If I can't get this one running I'll use Walter's. It
does work. I don't care how long the code is but I want to see the
difference between the 2 routines.).......................Pat
Michael Puckett wrote in message
<57CD777F7D14C161D2ACDCF6D0165971@in.WebX.maYIadrTaRb>...
|Dumb last minute changes before I posted it - I had renamed the variable
|AsciiCode to AscCode, but not everywhere. As I merely penned it and never
ran it
|I didn't catch the dumb error. There may still be dumb errors because I
still
|haven't run it.
|
| Dim AscCode as Integer
| AscCode = Asc(TextObj.TextString)
|
| Select Case AscCode
| Case 97 to 121, 65 to 89
| ' a - y, A - Y
| TextObj.TextString = Chr(AscCode + 1)
| Case 122, 90
| ' z, Z
| TextObj.TextString = Chr(AscCode - 25)
| Case else
| ' not an alpha character, need to
| ' write code for this scenario
| end select
|
|"Pat Schultz" wrote in message
|news:12EE787D359EA75DA349AC27A1A2BB15@in.WebX.maYIadrTaRb...
|> Michael, Thanks, you're not a budinski ! ! However, I cannot run your
|> routine. I snagged our resident VB guy to try to finish out the routine
but
|> he doesn't know AutoCAD objects and was unable to help me. Could you
please
|> add the prefixes and suffixes so all I have to do is cut & paste and F11
&
|> F8? Your help is most welcome!
|>
|> Much appreciated..............................Pat
|>
|> Michael Puckett wrote in message
|> <16716218E0562E7F8CC0A73BD4EFA83F@in.WebX.maYIadrTaRb>...
|> |' Why not use something like the following
|> |' (apologies, have not read entire thread)
|> |'
|> |'
|> |
|> | ' ...
|> | ' Other code
|> | ' ...
|> | '
|> | ' Assuming you wish to maintain case ...
|> |
|> | Dim AscCode as Integer
|> | AscCode = Asc(TextObj.TextString)
|> |
|> | Select Case AsciiCode
|> | Case 97 to 121, 65 to 89
|> | ' a - y, A - Y
|> | TextObj.TextString = Chr(AsciiCode + 1)
|> | Case 122, 90
|> | ' z, Z
|> | TextObj.TextString = Chr(AsciiCode - 25)
|> | Case else
|> | ' not an alpha character, need to
|> | ' write code for this scenario
|> | end select
|> |
|> | ' ...
|> | ' Other code
|> | ' ...
|> |
|> |' Would certainly reduce
|> |' the amount of code
|> |'
|> |' sorry I butted in
|> |'
|> |'
|> |
|> |"Walter" wrote in message
|> |news:CDFAF8DA1049F526EFAAF2E73A6A6723@in.WebX.maYIadrTaRb...
|> |> Pat,
|> |> Here's one way to do it. I know there's an easier way, but give this a
|> try
|> |> and tweak it as needed.
|> |>
|> |> '--Begin Routine--
|> |> Sub ad_Add1Alpha()
|> |> Dim TextObj As AcadObject
|> |> Dim basePnt As Variant
|> |> Dim objSelected As Integer
|> |>
|> |> objSelected = 1
|> |> Do While objSelected = 1
|> |> On Error GoTo exitsub
|> |> ThisDrawing.Utility.GetEntity TextObj, basePnt, "Select Text
to
|> |> Update>> "
|> |> If TextObj.ObjectName = "AcDbText" Or TextObj.ObjectName =
|> |> "AcDbMText" Then
|> |> Select Case TextObj.TextString
|> |> Case "A"
|> |> TextObj.TextString = "B"
|> |> Case "B"
|> |
|> |
|> |
|> |> Case "Z"
|> |> TextObj.TextString = "A"
|> |> End Select
|> |> End If
|> |> TextObj.Update
|> |> Loop
|> |> exitsub:
|> |> End Sub
|> |> '--End Routine--
|> |>
|> |> -- Walter -- http://www.ActiveDwg.com
|> |>
|> |
|>
|