Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Applications / Excel / October 2007



Tip: Looking for answers? Try searching our database.

text box

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ed - 09 Oct 2007 02:46 GMT
What do I have to add to the below code so that it changes all occurrances in
a text box as well as multiple text boxes?

Sub textbox()
   Dim FromStr As String
   Dim ToStr As String
   Dim TB As textbox
   Dim wks As Worksheet
   
   FromStr = "703b"
   ToStr = "800L"
   
   Set wks = ActiveSheet
   
   With wks
   For Each TB In .TextBoxes
       With TB
           .Text = Replace(expression:=.Text, _
               Find:=FromStr, _
               Replace:=ToStr, _
               Start:=1, _
               Count:=1, _
               compare:=vbTextCompare)
       End With
   Next TB
End With
               
               
               
               

               
           
       
   

End Sub
Signature

Ed

JE McGimpsey - 09 Oct 2007 05:34 GMT
> What do I have to add to the below code so that it changes all occurrances in
> a text box as well as multiple text boxes?

FIrst, since you're using the VBA6 Replace method, I'll assume that
you're not using XL for Macintosh, which is the subject of this
newsgroup (hence the ".mac." in the title). For future reference a
better group for WinXL specific questions would be

   microsoft.public.excel.programming

However, the answer to your question is to delete the

   .Count:=1, _

line from your code.
Ed - 10 Oct 2007 01:59 GMT
Hi JE McGimpsey,

Thanks for answering my question and thanks for pointing out that I was in
the wrong group.
Signature

Ed

> > What do I have to add to the below code so that it changes all occurrances in
> > a text box as well as multiple text boxes?
[quoted text clipped - 11 lines]
>
> line from your code.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.