<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: VBA / Find Replace / Quick Fix for Someone (not me...Please Help!!) in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/vba-find-replace-quick-fix-for-someone-not-me-please-help/m-p/1829447#M29649</link>
    <description>Sorry - &lt;BR /&gt;
It is 2007.&lt;BR /&gt;
&lt;BR /&gt;
I'm attaching a 2004 version.&lt;BR /&gt;
&lt;BR /&gt;
Thx!</description>
    <pubDate>Wed, 29 Nov 2006 15:45:32 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2006-11-29T15:45:32Z</dc:date>
    <item>
      <title>VBA / Find Replace / Quick Fix for Someone (not me...Please Help!!)</title>
      <link>https://forums.autodesk.com/t5/vba-forum/vba-find-replace-quick-fix-for-someone-not-me-please-help/m-p/1829444#M29646</link>
      <description>Need~&lt;BR /&gt;
I need to search through several hundred drawings and check to make sure the customer is "Dilling Mechanical" not "Corporate Construction" &lt;BR /&gt;
&lt;BR /&gt;
Tried/Problem~&lt;BR /&gt;
I tried using SRXTEXT and the script fails if the Title Block is correct and there are no replacements req'd.  I also tried using a single command (to no avail) in SRXTEXT as:  (srxTEXT "Substring" "CORPORATE CONSTRUCTION" "DILLING MECHANICAL" "All")  I get ; error: no function definition: SRXTEXT&lt;BR /&gt;
&lt;BR /&gt;
Also Tried~&lt;BR /&gt;
I found this VBA code on a post yesterday and I tried to alter the code to work on my situation.  I stepped through the code and the text that I'm trying to change doesn't get selected in the code.  It is in MSPACE.  How do we fix that?&lt;BR /&gt;
&lt;BR /&gt;
Attached~&lt;BR /&gt;
my VBA code attempt from post yesterday&lt;BR /&gt;
one of the sheets that need changed.&lt;BR /&gt;
&lt;BR /&gt;
Test for success-&lt;BR /&gt;
run a script, a snippet of code (VBA), or whatever twice through this dwg and the first time it changes the text.  'CORPORATE CONSTRUCTION' to 'DILLING MECHANICAL' and the second time runs through with out errors using the EXACT same input.  Some sheets need changed and some don't.&lt;BR /&gt;
&lt;BR /&gt;
Side Note/Question~&lt;BR /&gt;
How would I use a button to run a script.  Say the script is:&lt;BR /&gt;
C:\Scripts\runme.scr  what is the command of the button?&lt;BR /&gt;
&lt;BR /&gt;
THANKS THANK YOU MUCH OBLIGED!!!!!! &lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Thanks, &lt;BR /&gt;
MSR</description>
      <pubDate>Wed, 29 Nov 2006 13:35:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/vba-find-replace-quick-fix-for-someone-not-me-please-help/m-p/1829444#M29646</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-11-29T13:35:20Z</dc:date>
    </item>
    <item>
      <title>Re: VBA / Find Replace / Quick Fix for Someone (not me...Please Help!!)</title>
      <link>https://forums.autodesk.com/t5/vba-forum/vba-find-replace-quick-fix-for-someone-not-me-please-help/m-p/1829445#M29647</link>
      <description>Here is the attachment....</description>
      <pubDate>Wed, 29 Nov 2006 13:39:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/vba-find-replace-quick-fix-for-someone-not-me-please-help/m-p/1829445#M29647</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-11-29T13:39:28Z</dc:date>
    </item>
    <item>
      <title>Re: VBA / Find Replace / Quick Fix for Someone (not me...Please Help!!)</title>
      <link>https://forums.autodesk.com/t5/vba-forum/vba-find-replace-quick-fix-for-someone-not-me-please-help/m-p/1829446#M29648</link>
      <description>You haven't specified what version this dwg is... I've tried to open it in 2006 to no avail so I assume 2007?</description>
      <pubDate>Wed, 29 Nov 2006 15:34:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/vba-find-replace-quick-fix-for-someone-not-me-please-help/m-p/1829446#M29648</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-11-29T15:34:59Z</dc:date>
    </item>
    <item>
      <title>Re: VBA / Find Replace / Quick Fix for Someone (not me...Please Help!!)</title>
      <link>https://forums.autodesk.com/t5/vba-forum/vba-find-replace-quick-fix-for-someone-not-me-please-help/m-p/1829447#M29649</link>
      <description>Sorry - &lt;BR /&gt;
It is 2007.&lt;BR /&gt;
&lt;BR /&gt;
I'm attaching a 2004 version.&lt;BR /&gt;
&lt;BR /&gt;
Thx!</description>
      <pubDate>Wed, 29 Nov 2006 15:45:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/vba-find-replace-quick-fix-for-someone-not-me-please-help/m-p/1829447#M29649</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-11-29T15:45:32Z</dc:date>
    </item>
    <item>
      <title>Re: VBA / Find Replace / Quick Fix for Someone (not me...Please Help!!)</title>
      <link>https://forums.autodesk.com/t5/vba-forum/vba-find-replace-quick-fix-for-someone-not-me-please-help/m-p/1829448#M29650</link>
      <description>wrote code to do similar task recently. i'll look at it tonight to see if i can modify it.</description>
      <pubDate>Wed, 29 Nov 2006 15:51:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/vba-find-replace-quick-fix-for-someone-not-me-please-help/m-p/1829448#M29650</guid>
      <dc:creator>ska67can</dc:creator>
      <dc:date>2006-11-29T15:51:00Z</dc:date>
    </item>
    <item>
      <title>Re: VBA / Find Replace / Quick Fix for Someone (not me...Please Help!!)</title>
      <link>https://forums.autodesk.com/t5/vba-forum/vba-find-replace-quick-fix-for-someone-not-me-please-help/m-p/1829449#M29651</link>
      <description>The problem you are having is that the text you wish to change is contained within a title block, not as a text string, and is in layout, not model space.  I'll have a look when I get home &lt;span class="lia-unicode-emoji" title=":monkey_face:"&gt;🐵&lt;/span&gt;</description>
      <pubDate>Wed, 29 Nov 2006 15:53:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/vba-find-replace-quick-fix-for-someone-not-me-please-help/m-p/1829449#M29651</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-11-29T15:53:20Z</dc:date>
    </item>
    <item>
      <title>Re: VBA / Find Replace / Quick Fix for Someone (not me...Please Help!!)</title>
      <link>https://forums.autodesk.com/t5/vba-forum/vba-find-replace-quick-fix-for-someone-not-me-please-help/m-p/1829450#M29652</link>
      <description>Attached DVB would not work for you because of you&lt;BR /&gt;
tryed to change attributes neither text&lt;BR /&gt;
&lt;BR /&gt;
See my examle how you can to do it&lt;BR /&gt;
(one of many ways though)&lt;BR /&gt;
&lt;BR /&gt;
Option Explicit&lt;BR /&gt;
&lt;BR /&gt;
Sub Ch_TitleBlock_Att()&lt;BR /&gt;
&lt;BR /&gt;
     Dim oLayout As AcadLayout, _&lt;BR /&gt;
         oBlock As AcadBlock, _&lt;BR /&gt;
         oEnt As AcadEntity, _&lt;BR /&gt;
         blkRef As AcadBlockReference, _&lt;BR /&gt;
         attObj As AcadAttributeReference, _&lt;BR /&gt;
         attData() As AcadObject, _&lt;BR /&gt;
         newVal As String, _&lt;BR /&gt;
         bName As String, _&lt;BR /&gt;
         fType(2) As Integer, _&lt;BR /&gt;
         fData(2) As Variant, _&lt;BR /&gt;
         dxfType, _&lt;BR /&gt;
         dxfData, _&lt;BR /&gt;
         aTag As String, _&lt;BR /&gt;
         k As Integer&lt;BR /&gt;
&lt;BR /&gt;
     bName = InputBox("Enter Block Name To Change :", "Modify Tiltle Block", "TITLE_BLOCK")&lt;BR /&gt;
     aTag = InputBox("Enter Attribute Name To Change :", "Modify Tiltle Block", "PROJNAME")&lt;BR /&gt;
     newVal = InputBox("Enter New Attibute Value: ", "Modify Tiltle Block")&lt;BR /&gt;
&lt;BR /&gt;
     For Each oLayout In ThisDrawing.Layouts&lt;BR /&gt;
          For Each oEnt In oLayout.Block&lt;BR /&gt;
               If TypeOf oEnt Is AcadBlockReference Then&lt;BR /&gt;
                    Set blkRef = oEnt&lt;BR /&gt;
                    If blkRef.Name = bName Then&lt;BR /&gt;
                         attData = blkRef.GetAttributes&lt;BR /&gt;
                         For k = 0 To UBound(attData)&lt;BR /&gt;
                              Set attObj = attData(k)&lt;BR /&gt;
                              If attObj.TagString = aTag Then&lt;BR /&gt;
                                   attObj.TextString = newVal&lt;BR /&gt;
                                   attObj.Update&lt;BR /&gt;
                                   blkRef.Update&lt;BR /&gt;
                                   Exit For&lt;BR /&gt;
                              End If&lt;BR /&gt;
&lt;BR /&gt;
                         Next k&lt;BR /&gt;
                    End If&lt;BR /&gt;
               End If&lt;BR /&gt;
          Next oEnt&lt;BR /&gt;
     Next oLayout&lt;BR /&gt;
&lt;BR /&gt;
End Sub&lt;BR /&gt;
&lt;BR /&gt;
Fatty&lt;BR /&gt;
&lt;BR /&gt;
~'J'~</description>
      <pubDate>Wed, 29 Nov 2006 15:53:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/vba-find-replace-quick-fix-for-someone-not-me-please-help/m-p/1829450#M29652</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-11-29T15:53:58Z</dc:date>
    </item>
    <item>
      <title>Re: VBA / Find Replace / Quick Fix for Someone (not me...Please Help!!)</title>
      <link>https://forums.autodesk.com/t5/vba-forum/vba-find-replace-quick-fix-for-someone-not-me-please-help/m-p/1829451#M29653</link>
      <description>Thanks - &lt;BR /&gt;
&lt;BR /&gt;
The only problem that I see is that I can't use a script to completely automate with the message boxes popping up.  I like to watch the computer work; not my fingers!!! LOL&lt;BR /&gt;
&lt;BR /&gt;
How about this?---&lt;BR /&gt;
-- This would allow me to pass the parameters through the script into the VBA and still make the changes with IF statements??  What would my command line be for this (assuming that it works?)&lt;BR /&gt;
&lt;BR /&gt;
Also how do you program a button to do mulitline commands?&lt;BR /&gt;
What about the pgp file.  I want ZE to mean Zoom Extents but I haven't figured out how to program the pgp file to do that. &lt;BR /&gt;
THANKS A BUNCH&lt;BR /&gt;
&lt;BR /&gt;
Option Explicit&lt;BR /&gt;
&lt;BR /&gt;
Sub Ch_TitleBlock_Att (bName as String, aTag as String, newVal as String)&lt;BR /&gt;
&lt;BR /&gt;
Dim oLayout As AcadLayout, _&lt;BR /&gt;
oBlock As AcadBlock, _&lt;BR /&gt;
oEnt As AcadEntity, _&lt;BR /&gt;
blkRef As AcadBlockReference, _&lt;BR /&gt;
attObj As AcadAttributeReference, _&lt;BR /&gt;
attData() As AcadObject, _&lt;BR /&gt;
newVal As String, _&lt;BR /&gt;
bName As String, _&lt;BR /&gt;
fType(2) As Integer, _&lt;BR /&gt;
fData(2) As Variant, _&lt;BR /&gt;
dxfType, _&lt;BR /&gt;
dxfData, _&lt;BR /&gt;
aTag As String, _&lt;BR /&gt;
k As Integer&lt;BR /&gt;
&lt;BR /&gt;
For Each oLayout In ThisDrawing.Layouts&lt;BR /&gt;
For Each oEnt In oLayout.Block&lt;BR /&gt;
&lt;BR /&gt;
If TypeOf oEnt Is AcadBlockReference Then&lt;BR /&gt;
Set blkRef = oEnt&lt;BR /&gt;
If blkRef.Name = bName Then&lt;BR /&gt;
attData = blkRef.GetAttributes&lt;BR /&gt;
For k = 0 To UBound(attData)&lt;BR /&gt;
Set attObj = attData(k)&lt;BR /&gt;
If attObj.TagString = aTag Then&lt;BR /&gt;
attObj.TextString = newVal&lt;BR /&gt;
attObj.Update&lt;BR /&gt;
blkRef.Update&lt;BR /&gt;
Exit For&lt;BR /&gt;
End If&lt;BR /&gt;
&lt;BR /&gt;
Next k&lt;BR /&gt;
End If&lt;BR /&gt;
End If&lt;BR /&gt;
Next oEnt&lt;BR /&gt;
Next oLayout&lt;BR /&gt;
&lt;BR /&gt;
End Sub</description>
      <pubDate>Wed, 29 Nov 2006 18:43:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/vba-find-replace-quick-fix-for-someone-not-me-please-help/m-p/1829451#M29653</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-11-29T18:43:44Z</dc:date>
    </item>
    <item>
      <title>Re: VBA / Find Replace / Quick Fix for Someone (not me...Please Help!!)</title>
      <link>https://forums.autodesk.com/t5/vba-forum/vba-find-replace-quick-fix-for-someone-not-me-please-help/m-p/1829452#M29654</link>
      <description>I agree, let the machine works, I like to drink a beer instead &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
Here is my old one, slightly edited&lt;BR /&gt;
Put this unzipped in any of your "Support File Search Path" folders&lt;BR /&gt;
&lt;BR /&gt;
Macro on button:&lt;BR /&gt;
&lt;BR /&gt;
^C^C^P_-vbarun;ch-att-val.dvb!RunMe&lt;BR /&gt;
&lt;BR /&gt;
Tested with button on A2005 only&lt;BR /&gt;
&lt;BR /&gt;
Fatty&lt;BR /&gt;
&lt;BR /&gt;
~'J'~</description>
      <pubDate>Wed, 29 Nov 2006 22:47:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/vba-find-replace-quick-fix-for-someone-not-me-please-help/m-p/1829452#M29654</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-11-29T22:47:41Z</dc:date>
    </item>
    <item>
      <title>Re: VBA / Find Replace / Quick Fix for Someone (not me...Please Help!!)</title>
      <link>https://forums.autodesk.com/t5/vba-forum/vba-find-replace-quick-fix-for-someone-not-me-please-help/m-p/1829453#M29655</link>
      <description>Wow - That is pretty amazing.  I am very familiar with VBA in Excel and I  am just learning VBA in cad.  I really appreciate what you've done.  However it still doesn't really solve my problem.  I have a script generator that has two parts.  A file selection part and a script part.  I need a tool (VBA / Lisp) etc that will take a command line and change the any text (block att, mtext, etc...) given a find (textA) and replace with (textB).  SRXTEXT works great as long as (textA) exist; the problem comes when the dwg is correct as is and SRXTEXT doesn't find an instance of (textA)&lt;BR /&gt;
I have hundreds of dwgs to check, not all of them need corrected.  This has to easy for you to do.  I'm just not able to clearly state the problem maybe.&lt;BR /&gt;
&lt;BR /&gt;
I have 100's of drawings and in some of them the customer is labled as 'CORPORATE CONSTRUCTION'.  When this is the case 'CORPORATE CONSTRUCTION' needs to be replaced with 'DILLING MECHANICAL'.  The problem is complicated by the fact the some of title blocks have been exploded and some of them don't need fixed.  So one set of commands will be applied to every dwg and I can just watch it do its thing - and enjoy a drink as you put it!!!  I hope that is more clear.  Thanks for all of your help.</description>
      <pubDate>Fri, 01 Dec 2006 18:38:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/vba-find-replace-quick-fix-for-someone-not-me-please-help/m-p/1829453#M29655</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-12-01T18:38:01Z</dc:date>
    </item>
    <item>
      <title>Re: VBA / Find Replace / Quick Fix for Someone (not me...Please Help!!)</title>
      <link>https://forums.autodesk.com/t5/vba-forum/vba-find-replace-quick-fix-for-someone-not-me-please-help/m-p/1829454#M29656</link>
      <description>Hi Mike&lt;BR /&gt;
Sorry my stupidity&lt;BR /&gt;
I read your message 5 times but have  not understand your task enough&lt;BR /&gt;
Let me explain it again&lt;BR /&gt;
Thus you have some blocks in the drawing and some exploded blocks there&lt;BR /&gt;
In the first case you need to change attribute values, in the&lt;BR /&gt;
second case you need change text/mtext you found&lt;BR /&gt;
And two these tasks I must to union and solve in one programm&lt;BR /&gt;
Let me know if I am wrong&lt;BR /&gt;
Or better yet attach this bad drawing with some good and bad (exploded) blocks &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
&lt;BR /&gt;
~'J'~</description>
      <pubDate>Fri, 01 Dec 2006 19:25:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/vba-find-replace-quick-fix-for-someone-not-me-please-help/m-p/1829454#M29656</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-12-01T19:25:12Z</dc:date>
    </item>
    <item>
      <title>Re: VBA / Find Replace / Quick Fix for Someone (not me...Please Help!!)</title>
      <link>https://forums.autodesk.com/t5/vba-forum/vba-find-replace-quick-fix-for-someone-not-me-please-help/m-p/1829455#M29657</link>
      <description>I think we're on the same page now!!&lt;BR /&gt;
&lt;BR /&gt;
What I need the code to do is make sure that the customer (whether in block form or not) is 'DILLING MECHANICAL' not 'CORPORATE CONSTRUCTION' without user input.  This will allow me use a script generator to apply the code to all of the dwgs.&lt;BR /&gt;
&lt;BR /&gt;
I'm attaching 4 dwgs.  One for each possible case.  Remember there are litterally hundreds of these.  I have a script generator that I can use to write the script to do the following:&lt;BR /&gt;
&lt;BR /&gt;
1)open dwg&lt;BR /&gt;
2) apply code you provide&lt;BR /&gt;
3) save &amp;amp; close dwg&lt;BR /&gt;
--&amp;gt; repeat for next dwg until complete.&lt;BR /&gt;
&lt;BR /&gt;
Each drawing will be one of the following catagories.  I have attached a typical exp. for each type.&lt;BR /&gt;
&lt;BR /&gt;
1) Title block is intact and is correct as is - no action req'd but code still runs through without errors or user input req'd.&lt;BR /&gt;
2) Title block is intact but needs 'CORPORATE CONSTRUCTION' changed to 'DILLING MECHANICAL' This is the 'CUSTOMER att of the TITLE_BLOCK.&lt;BR /&gt;
3) Title block has been exploded is ok as is - no action req'd but code must still run through as before..&lt;BR /&gt;
4) Title block has been exploded but needs text 'CORPORATE CONSTRUCTION' changed to 'DILLING MECHANICAL'&lt;BR /&gt;
&lt;BR /&gt;
Thanks!&lt;BR /&gt;
MSR</description>
      <pubDate>Fri, 01 Dec 2006 20:26:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/vba-find-replace-quick-fix-for-someone-not-me-please-help/m-p/1829455#M29657</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-12-01T20:26:16Z</dc:date>
    </item>
    <item>
      <title>Re: VBA / Find Replace / Quick Fix for Someone (not me...Please Help!!)</title>
      <link>https://forums.autodesk.com/t5/vba-forum/vba-find-replace-quick-fix-for-someone-not-me-please-help/m-p/1829456#M29658</link>
      <description>Okay, I'll work with this tomorrow&lt;BR /&gt;
Now is clear enough for me&lt;BR /&gt;
:)&lt;BR /&gt;
&lt;BR /&gt;
~'J'~</description>
      <pubDate>Fri, 01 Dec 2006 21:24:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/vba-find-replace-quick-fix-for-someone-not-me-please-help/m-p/1829456#M29658</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-12-01T21:24:01Z</dc:date>
    </item>
    <item>
      <title>Re: VBA / Find Replace / Quick Fix for Someone (not me...Please Help!!)</title>
      <link>https://forums.autodesk.com/t5/vba-forum/vba-find-replace-quick-fix-for-someone-not-me-please-help/m-p/1829457#M29659</link>
      <description>Hello MSR&lt;BR /&gt;
Here is framework only &lt;BR /&gt;
This will change text objects only, if you will not&lt;BR /&gt;
found some mistakes here I will be go further with&lt;BR /&gt;
block change part&lt;BR /&gt;
Make sure your current version ObjectDBX library&lt;BR /&gt;
in Tools-&amp;gt;Reference&lt;BR /&gt;
Tested on A2005 only&lt;BR /&gt;
&lt;BR /&gt;
~'J'~</description>
      <pubDate>Fri, 01 Dec 2006 23:54:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/vba-find-replace-quick-fix-for-someone-not-me-please-help/m-p/1829457#M29659</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-12-01T23:54:22Z</dc:date>
    </item>
    <item>
      <title>Re: VBA / Find Replace / Quick Fix for Someone (not me...Please Help!!)</title>
      <link>https://forums.autodesk.com/t5/vba-forum/vba-find-replace-quick-fix-for-someone-not-me-please-help/m-p/1829458#M29660</link>
      <description>Try this. You'll have to add a reference to excel &amp;amp; mso object library. Run macro, select folder where drawings are located and go have a drink. Takes care of both blocks and plain text.&lt;BR /&gt;
&lt;BR /&gt;
code:&lt;BR /&gt;
Option Explicit&lt;BR /&gt;
Option Compare Text&lt;BR /&gt;
&lt;BR /&gt;
Public oExcel As excel.Application&lt;BR /&gt;
Public dCount As Integer&lt;BR /&gt;
Public foldSel As Variant&lt;BR /&gt;
Public foldName As String&lt;BR /&gt;
Public fsObj As Variant&lt;BR /&gt;
Public foldObj As Variant&lt;BR /&gt;
Public fileObj As Variant&lt;BR /&gt;
Public fName As Variant&lt;BR /&gt;
Public sCount As Integer&lt;BR /&gt;
Public mResponse As Integer&lt;BR /&gt;
Public fStr As String&lt;BR /&gt;
Public sText As String&lt;BR /&gt;
Public sStr As Long&lt;BR /&gt;
Public fCount As Integer&lt;BR /&gt;
Public intI As Integer&lt;BR /&gt;
Public bRefVar As Variant&lt;BR /&gt;
Public blockObj As AcadBlock&lt;BR /&gt;
Public bRefObj As AcadBlockReference&lt;BR /&gt;
Public textObj As AcadText&lt;BR /&gt;
Public entObj As AcadEntity&lt;BR /&gt;
&lt;BR /&gt;
Public Sub ReplaceText()&lt;BR /&gt;
&lt;BR /&gt;
Set oExcel = excel.Application&lt;BR /&gt;
'Save &amp;amp; Close all Active Drawings&lt;BR /&gt;
If AutoCAD.Application.Documents.Count &amp;lt;&amp;gt; 0 Then&lt;BR /&gt;
    For dCount = 0 To AutoCAD.Application.Documents.Count - 1&lt;BR /&gt;
    AutoCAD.ActiveDocument.Save&lt;BR /&gt;
    AutoCAD.ActiveDocument.Close&lt;BR /&gt;
    Next&lt;BR /&gt;
End If&lt;BR /&gt;
&lt;BR /&gt;
' Open the Folder Dialog&lt;BR /&gt;
Do While sCount = 0&lt;BR /&gt;
Set foldSel = oExcel.FileDialog(msoFileDialogFolderPicker)&lt;BR /&gt;
With foldSel&lt;BR /&gt;
    .Title = "Choose Folder Containing drawing Files to be Updated"&lt;BR /&gt;
    'If Folder Selected&lt;BR /&gt;
    If .Show = -1 Then&lt;BR /&gt;
        foldName = CStr(.SelectedItems.Item(1))&lt;BR /&gt;
    Else            'User Cancelled-Exit Macro&lt;BR /&gt;
        MsgBox "No selection made. Program Cancelled."&lt;BR /&gt;
        oExcel.Quit&lt;BR /&gt;
        Exit Sub&lt;BR /&gt;
    End If&lt;BR /&gt;
End With&lt;BR /&gt;
&lt;BR /&gt;
Set fsObj = CreateObject("Scripting.FileSystemObject")&lt;BR /&gt;
Set foldObj = fsObj.GetFolder(foldName)&lt;BR /&gt;
Set fileObj = foldObj.Files&lt;BR /&gt;
&lt;BR /&gt;
'Determine if Folder Contains Dwg Files&lt;BR /&gt;
sCount = CountFiles(foldName)   'Calls the Function&lt;BR /&gt;
If sCount = 0 Then              'No Dwg Files Found in Selected Folder&lt;BR /&gt;
    'Give User Choice to Retry or Quit&lt;BR /&gt;
    mResponse = MsgBox(foldName &amp;amp; Chr(13) &amp;amp; _&lt;BR /&gt;
    " Does Not Contain Drawing Files", vbRetryCancel)&lt;BR /&gt;
    If mResponse = 2 Then       'User Cancelled-Exit Macro&lt;BR /&gt;
        MsgBox "Program Cancelled."&lt;BR /&gt;
        oExcel.Quit&lt;BR /&gt;
        Exit Sub&lt;BR /&gt;
    End If&lt;BR /&gt;
End If&lt;BR /&gt;
Loop&lt;BR /&gt;
&lt;BR /&gt;
'Check if Subfolder Exists&lt;BR /&gt;
If CheckDir(foldName &amp;amp; "\Updated Drawings") Then&lt;BR /&gt;
    MsgBox foldName &amp;amp; " Already Updated"&lt;BR /&gt;
    Exit Sub&lt;BR /&gt;
End If&lt;BR /&gt;
'Create SubFolder for Updated Dwgs&lt;BR /&gt;
MkDir foldName &amp;amp; "\Updated Drawings"&lt;BR /&gt;
&lt;BR /&gt;
'Open Each Drawing in Selected Folder&lt;BR /&gt;
For Each fName In fileObj&lt;BR /&gt;
&lt;BR /&gt;
    If Right(fName.Name, 3) = "dwg" Then&lt;BR /&gt;
        fStr = fName.Name&lt;BR /&gt;
    End If&lt;BR /&gt;
&lt;BR /&gt;
    AutoCAD.Application.Documents.Open (foldName &amp;amp; "\" &amp;amp; fStr)&lt;BR /&gt;
    &lt;BR /&gt;
    For Each entObj In ThisDrawing.PaperSpace&lt;BR /&gt;
        If entObj.ObjectName = "AcDbBlockReference" Then&lt;BR /&gt;
            Set bRefObj = entObj&lt;BR /&gt;
            With ThisDrawing.Utility&lt;BR /&gt;
                If bRefObj.HasAttributes Then&lt;BR /&gt;
                    bRefVar = bRefObj.GetAttributes&lt;BR /&gt;
                    For intI = LBound(bRefVar) To UBound(bRefVar)&lt;BR /&gt;
                        sText = bRefVar(intI).TextString&lt;BR /&gt;
                        If sText = "CORPORATE CONSTRUCTION" Then&lt;BR /&gt;
                            bRefVar(intI).TextString = "DILLING MECHANICAL"&lt;BR /&gt;
                        End If&lt;BR /&gt;
                    Next&lt;BR /&gt;
                End If&lt;BR /&gt;
            End With&lt;BR /&gt;
        End If&lt;BR /&gt;
    Next&lt;BR /&gt;
    &lt;BR /&gt;
    For Each entObj In ThisDrawing.PaperSpace&lt;BR /&gt;
        If entObj.ObjectName = "AcDbText" Then&lt;BR /&gt;
            If entObj.TextString = "CORPORATE CONSTRUCTION" Then&lt;BR /&gt;
                entObj.TextString = "DILLING MECHANICAL"&lt;BR /&gt;
            End If&lt;BR /&gt;
        End If&lt;BR /&gt;
    Next&lt;BR /&gt;
&lt;BR /&gt;
    sStr = Len(AutoCAD.ActiveDocument.Name)&lt;BR /&gt;
    fStr = Left(AutoCAD.ActiveDocument.Name, sStr - 4)&lt;BR /&gt;
    &lt;BR /&gt;
    'Rename Dwg &amp;amp; Save in Different Folder&lt;BR /&gt;
    AutoCAD.ActiveDocument.SaveAs (foldName &amp;amp; "\Updated Drawings\" &amp;amp; fStr &amp;amp; " UPDATED.dwg")&lt;BR /&gt;
    'Close Dwg&lt;BR /&gt;
    AutoCAD.ActiveDocument.Close&lt;BR /&gt;
Next&lt;BR /&gt;
&lt;BR /&gt;
oExcel.Quit&lt;BR /&gt;
&lt;BR /&gt;
fCount = CountFiles(foldName &amp;amp; "\Updated Drawings")&lt;BR /&gt;
MsgBox sCount &amp;amp; " Files Selected" &amp;amp; Chr(13) &amp;amp; fCount &amp;amp; " Files Updated"&lt;BR /&gt;
&lt;BR /&gt;
End Sub&lt;BR /&gt;
&lt;BR /&gt;
Function CountFiles(tgtDir As String) As Integer&lt;BR /&gt;
&lt;BR /&gt;
Dim fName As String&lt;BR /&gt;
fName = Dir(tgtDir &amp;amp; "\*.dwg")&lt;BR /&gt;
On Error GoTo 0&lt;BR /&gt;
'loop through all files in the directory and increment the function's value&lt;BR /&gt;
Do While fName &amp;lt;&amp;gt; ""&lt;BR /&gt;
    If fName &amp;lt;&amp;gt; "." And fName &amp;lt;&amp;gt; ".." Then&lt;BR /&gt;
        CountFiles = CountFiles + 1&lt;BR /&gt;
    End If&lt;BR /&gt;
    ' Get next entry.&lt;BR /&gt;
    fName = Dir()&lt;BR /&gt;
Loop&lt;BR /&gt;
&lt;BR /&gt;
End Function&lt;BR /&gt;
&lt;BR /&gt;
Function CheckDir(newDir As String) As Boolean&lt;BR /&gt;
&lt;BR /&gt;
    If Dir(newDir, vbDirectory) &amp;lt;&amp;gt; "" Then CheckDir = True&lt;BR /&gt;
    &lt;BR /&gt;
End Function</description>
      <pubDate>Sat, 02 Dec 2006 00:11:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/vba-find-replace-quick-fix-for-someone-not-me-please-help/m-p/1829458#M29660</guid>
      <dc:creator>ska67can</dc:creator>
      <dc:date>2006-12-02T00:11:40Z</dc:date>
    </item>
    <item>
      <title>Re: VBA / Find Replace / Quick Fix for Someone (not me...Please Help!!)</title>
      <link>https://forums.autodesk.com/t5/vba-forum/vba-find-replace-quick-fix-for-someone-not-me-please-help/m-p/1829459#M29661</link>
      <description>Hi MSR,&lt;BR /&gt;
I have to added the part that allow to change blocks etc also&lt;BR /&gt;
This will work with default values, feel free to change&lt;BR /&gt;
to your suit&lt;BR /&gt;
Try edited version let me know if something wrong there&lt;BR /&gt;
Hth&lt;BR /&gt;
&lt;BR /&gt;
Fatty&lt;BR /&gt;
&lt;BR /&gt;
~'J'~</description>
      <pubDate>Sat, 02 Dec 2006 10:19:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/vba-find-replace-quick-fix-for-someone-not-me-please-help/m-p/1829459#M29661</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-12-02T10:19:29Z</dc:date>
    </item>
    <item>
      <title>Re: VBA / Find Replace / Quick Fix for Someone (not me...Please Help!!)</title>
      <link>https://forums.autodesk.com/t5/vba-forum/vba-find-replace-quick-fix-for-someone-not-me-please-help/m-p/1829460#M29662</link>
      <description>Fatty,&lt;BR /&gt;
&lt;BR /&gt;
I just got in and had a chance to look at your responses.  Before I even load the project I wanted to shout a big THANKS!  Im sure that this will work as we got on the same sheet of music.  Wish I could buy you a drink now too - you deserve it!!!&lt;BR /&gt;
&lt;BR /&gt;
I'll load the project here in a little while and let you know that it works great.&lt;BR /&gt;
&lt;BR /&gt;
Thanks again,&lt;BR /&gt;
MSR&lt;BR /&gt;
&lt;BR /&gt;
PS - Does Autodesk pay you for this stuff or are you some kind of CodeAngel??  LOL!!</description>
      <pubDate>Mon, 04 Dec 2006 13:40:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/vba-find-replace-quick-fix-for-someone-not-me-please-help/m-p/1829460#M29662</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-12-04T13:40:47Z</dc:date>
    </item>
    <item>
      <title>Re: VBA / Find Replace / Quick Fix for Someone (not me...Please Help!!)</title>
      <link>https://forums.autodesk.com/t5/vba-forum/vba-find-replace-quick-fix-for-someone-not-me-please-help/m-p/1829461#M29663</link>
      <description>Comon, MSR&lt;BR /&gt;
I am stupid haker only and nothing else, I'm still on the same&lt;BR /&gt;
level as I was 3 years ago...&lt;BR /&gt;
No flowers, please&lt;BR /&gt;
Let me know if something wrong here&lt;BR /&gt;
Anyway my big thanks for the kindly words&lt;BR /&gt;
&lt;BR /&gt;
Happy computing,&lt;BR /&gt;
&lt;BR /&gt;
Cheers &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
&lt;BR /&gt;
~'J'~</description>
      <pubDate>Mon, 04 Dec 2006 13:52:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/vba-find-replace-quick-fix-for-someone-not-me-please-help/m-p/1829461#M29663</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-12-04T13:52:43Z</dc:date>
    </item>
    <item>
      <title>Re: VBA / Find Replace / Quick Fix for Someone (not me...Please Help!!)</title>
      <link>https://forums.autodesk.com/t5/vba-forum/vba-find-replace-quick-fix-for-someone-not-me-please-help/m-p/1829462#M29664</link>
      <description>Hey it works great!&lt;BR /&gt;
&lt;BR /&gt;
I have a two second fix for you.  I added text box to the form and tried to set it up so that it updates the dwg being edited.&lt;BR /&gt;
&lt;BR /&gt;
The code I used is below (nested into your code)&lt;BR /&gt;
Doesn't update.   Is this because of the DoEvents command?&lt;BR /&gt;
&lt;BR /&gt;
          oDbx.Open DwgName&lt;BR /&gt;
          frmReplace.txtDWG.value = DwgName&lt;BR /&gt;
&lt;BR /&gt;
          For Each oLayout In oDbx.Layouts&lt;BR /&gt;
               For Each objFnd In oLayout.Block&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
That is a really cool app - we'll definitely get lot of use out of it.&lt;BR /&gt;
&lt;BR /&gt;
Thanks, MSR</description>
      <pubDate>Mon, 04 Dec 2006 18:21:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/vba-find-replace-quick-fix-for-someone-not-me-please-help/m-p/1829462#M29664</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-12-04T18:21:00Z</dc:date>
    </item>
  </channel>
</rss>

