<?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: Changing Current Layout in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/changing-current-layout/m-p/2651399#M66357</link>
    <description>Thanks for the response. I have command flags.session in there but for some reason it still doesn't change layouts. I was running it from a form so I tried putting it in the command routine,But it still doesn't change. It doesn't give an error either. Aside from the imports here is the code leading up to the change. &lt;BR /&gt;
&lt;BR /&gt;
   CommandMethod("PCL", CommandFlags.Session) &lt;BR /&gt;
Public Sub PCL() &lt;BR /&gt;
&lt;BR /&gt;
        Dim acDoc As Document = Application.DocumentManager.MdiActiveDocument &lt;BR /&gt;
        Dim acCurDb As Database = acDoc.Database &lt;BR /&gt;
&lt;BR /&gt;
        Using acTrans As Transaction = acCurDb.TransactionManager.StartTransaction() &lt;BR /&gt;
&lt;BR /&gt;
            Dim acLayoutMgr As LayoutManager &lt;BR /&gt;
            acLayoutMgr = LayoutManager.Current &lt;BR /&gt;
            acLayoutMgr.CurrentLayout = "Model" &lt;BR /&gt;
            MsgBox("Current Layout = " + acLayoutMgr.CurrentLayout) &lt;BR /&gt;
&lt;BR /&gt;
current layout is still "Layout1" &lt;BR /&gt;
&lt;BR /&gt;
Thanks again.</description>
    <pubDate>Fri, 19 Mar 2010 14:16:50 GMT</pubDate>
    <dc:creator>GeeHaa</dc:creator>
    <dc:date>2010-03-19T14:16:50Z</dc:date>
    <item>
      <title>Changing Current Layout</title>
      <link>https://forums.autodesk.com/t5/net-forum/changing-current-layout/m-p/2651396#M66354</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
Can anyone tell me why this code doesn't Change the current layout.&lt;BR /&gt;
&lt;BR /&gt;
Dim acLayoutMgr As LayoutManager&lt;BR /&gt;
acLayoutMgr = LayoutManager.Current&lt;BR /&gt;
acLayoutMgr.CurrentLayout = "Model"&lt;BR /&gt;
&lt;BR /&gt;
Thanks in Advance</description>
      <pubDate>Thu, 18 Mar 2010 19:02:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/changing-current-layout/m-p/2651396#M66354</guid>
      <dc:creator>GeeHaa</dc:creator>
      <dc:date>2010-03-18T19:02:26Z</dc:date>
    </item>
    <item>
      <title>Re: Changing Current Layout</title>
      <link>https://forums.autodesk.com/t5/net-forum/changing-current-layout/m-p/2651397#M66355</link>
      <description>The code I have is intended to activate a newly created layout tab, and ran in a command that has to be run from the Model tab, so I had to test it to see if it would activate the model tab and it worked fine.  So the problem is not the code you posted.  &lt;BR /&gt;
&lt;BR /&gt;
Perhaps it has to do with where the code is running from (ie from code in a form class), but you'll have to provide more info for anyone to help.&lt;BR /&gt;
&lt;BR /&gt;
If the code is as it is posted (always activates the Model tab, never any other tab) then you could try setting the system variable TILEMODE to 1 and see if that works.</description>
      <pubDate>Thu, 18 Mar 2010 21:23:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/changing-current-layout/m-p/2651397#M66355</guid>
      <dc:creator>chiefbraincloud</dc:creator>
      <dc:date>2010-03-18T21:23:41Z</dc:date>
    </item>
    <item>
      <title>Re: Changing Current Layout</title>
      <link>https://forums.autodesk.com/t5/net-forum/changing-current-layout/m-p/2651398#M66356</link>
      <description>try adding the session flag&lt;BR /&gt;
&lt;BR /&gt;
Autodesk.AutoCAD.Runtime.CommandMethod("CommandName", Autodesk.AutoCAD.Runtime.CommandFlags.Session)</description>
      <pubDate>Thu, 18 Mar 2010 21:44:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/changing-current-layout/m-p/2651398#M66356</guid>
      <dc:creator>arcticad</dc:creator>
      <dc:date>2010-03-18T21:44:30Z</dc:date>
    </item>
    <item>
      <title>Re: Changing Current Layout</title>
      <link>https://forums.autodesk.com/t5/net-forum/changing-current-layout/m-p/2651399#M66357</link>
      <description>Thanks for the response. I have command flags.session in there but for some reason it still doesn't change layouts. I was running it from a form so I tried putting it in the command routine,But it still doesn't change. It doesn't give an error either. Aside from the imports here is the code leading up to the change. &lt;BR /&gt;
&lt;BR /&gt;
   CommandMethod("PCL", CommandFlags.Session) &lt;BR /&gt;
Public Sub PCL() &lt;BR /&gt;
&lt;BR /&gt;
        Dim acDoc As Document = Application.DocumentManager.MdiActiveDocument &lt;BR /&gt;
        Dim acCurDb As Database = acDoc.Database &lt;BR /&gt;
&lt;BR /&gt;
        Using acTrans As Transaction = acCurDb.TransactionManager.StartTransaction() &lt;BR /&gt;
&lt;BR /&gt;
            Dim acLayoutMgr As LayoutManager &lt;BR /&gt;
            acLayoutMgr = LayoutManager.Current &lt;BR /&gt;
            acLayoutMgr.CurrentLayout = "Model" &lt;BR /&gt;
            MsgBox("Current Layout = " + acLayoutMgr.CurrentLayout) &lt;BR /&gt;
&lt;BR /&gt;
current layout is still "Layout1" &lt;BR /&gt;
&lt;BR /&gt;
Thanks again.</description>
      <pubDate>Fri, 19 Mar 2010 14:16:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/changing-current-layout/m-p/2651399#M66357</guid>
      <dc:creator>GeeHaa</dc:creator>
      <dc:date>2010-03-19T14:16:50Z</dc:date>
    </item>
    <item>
      <title>Re: Changing Current Layout</title>
      <link>https://forums.autodesk.com/t5/net-forum/changing-current-layout/m-p/2651400#M66358</link>
      <description>Use Try..Catch to find a problem easily, i.e.&lt;BR /&gt;
{code}&lt;BR /&gt;
    Public Sub PCL()&lt;BR /&gt;
        Dim acDoc As Document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument&lt;BR /&gt;
        Dim acCurDb As Database = acDoc.Database&lt;BR /&gt;
        Using doclock As DocumentLock = acDoc.LockDocument&lt;BR /&gt;
            Using acTrans As Transaction = acCurDb.TransactionManager.StartTransaction()&lt;BR /&gt;
                Try&lt;BR /&gt;
                    Dim acLayoutMgr As LayoutManager&lt;BR /&gt;
                    acLayoutMgr = LayoutManager.Current&lt;BR /&gt;
                    acLayoutMgr.CurrentLayout = "Model"&lt;BR /&gt;
&lt;BR /&gt;
                    MsgBox("Current Layout = " + acLayoutMgr.CurrentLayout)&lt;BR /&gt;
                    acTrans.Commit()&lt;BR /&gt;
                Catch ex As Autodesk.AutoCAD.Runtime.Exception&lt;BR /&gt;
                    Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog(ex.Message &amp;amp; vbCr &amp;amp; ex.StackTrace)&lt;BR /&gt;
                End Try&lt;BR /&gt;
&lt;BR /&gt;
            End Using&lt;BR /&gt;
        End Using&lt;BR /&gt;
    End Sub&lt;BR /&gt;
{code}&lt;BR /&gt;
&lt;BR /&gt;
~'J'~</description>
      <pubDate>Fri, 19 Mar 2010 16:01:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/changing-current-layout/m-p/2651400#M66358</guid>
      <dc:creator>Hallex</dc:creator>
      <dc:date>2010-03-19T16:01:30Z</dc:date>
    </item>
    <item>
      <title>Re: Changing Current Layout</title>
      <link>https://forums.autodesk.com/t5/net-forum/changing-current-layout/m-p/2651401#M66359</link>
      <description>I found it rolled back if you don't commit the transaction&lt;BR /&gt;
&lt;BR /&gt;
If you leave out the commit, the layout changes, displays the layout name, and then checking okay rolls back</description>
      <pubDate>Fri, 19 Mar 2010 16:08:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/changing-current-layout/m-p/2651401#M66359</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-03-19T16:08:01Z</dc:date>
    </item>
    <item>
      <title>Re: Changing Current Layout</title>
      <link>https://forums.autodesk.com/t5/net-forum/changing-current-layout/m-p/2651402#M66360</link>
      <description>Locking the document did the trick. It changes the layout immediately even before the commit. I'm curious though, does Using Doclock lock the document just for this transaction and release it with the end Using statement?</description>
      <pubDate>Fri, 19 Mar 2010 17:05:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/changing-current-layout/m-p/2651402#M66360</guid>
      <dc:creator>GeeHaa</dc:creator>
      <dc:date>2010-03-19T17:05:13Z</dc:date>
    </item>
    <item>
      <title>Re: Changing Current Layout</title>
      <link>https://forums.autodesk.com/t5/net-forum/changing-current-layout/m-p/2651403#M66361</link>
      <description>Yes. the DocumentLock is disposed at the End Using.&lt;BR /&gt;
&lt;BR /&gt;
You actually don't need a transaction to do this at all.  You need the DocumentLock because you are running it from a form (which is why I mentioned form code earlier), but my code works fine without either a transaction or a DocumentLock, running from a CommandMethod in a Module.</description>
      <pubDate>Fri, 19 Mar 2010 17:50:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/changing-current-layout/m-p/2651403#M66361</guid>
      <dc:creator>chiefbraincloud</dc:creator>
      <dc:date>2010-03-19T17:50:18Z</dc:date>
    </item>
    <item>
      <title>Re: Changing Current Layout</title>
      <link>https://forums.autodesk.com/t5/net-forum/changing-current-layout/m-p/3251792#M66362</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I still cannot understand the solution, i tried in many ways but it couldnt work. Can you please clarify much more&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Tamer Mourad&lt;/P&gt;</description>
      <pubDate>Tue, 06 Dec 2011 16:00:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/changing-current-layout/m-p/3251792#M66362</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-12-06T16:00:47Z</dc:date>
    </item>
    <item>
      <title>Re: Changing Current Layout</title>
      <link>https://forums.autodesk.com/t5/net-forum/changing-current-layout/m-p/3251902#M66363</link>
      <description>&lt;P&gt;Show us what you have so far.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Dec 2011 16:45:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/changing-current-layout/m-p/3251902#M66363</guid>
      <dc:creator>fieldguy</dc:creator>
      <dc:date>2011-12-06T16:45:40Z</dc:date>
    </item>
    <item>
      <title>Re: Changing Current Layout</title>
      <link>https://forums.autodesk.com/t5/net-forum/changing-current-layout/m-p/3251940#M66364</link>
      <description>&lt;P&gt;Here it is&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;lt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;&lt;FONT color="#2b91af" size="2" face="Consolas"&gt;&lt;FONT color="#2b91af" size="2" face="Consolas"&gt;CommandMethod&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#a31515" size="2" face="Consolas"&gt;&lt;FONT color="#a31515" size="2" face="Consolas"&gt;&lt;FONT color="#a31515" size="2" face="Consolas"&gt;"t13"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;)&amp;gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;Public&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;Sub&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;T13()&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" size="2" face="Consolas"&gt;&lt;FONT color="#008000" size="2" face="Consolas"&gt;&lt;FONT color="#008000" size="2" face="Consolas"&gt;'Change the drawing Number&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;MsgBox(&lt;FONT color="#a31515" size="2" face="Consolas"&gt;&lt;FONT color="#a31515" size="2" face="Consolas"&gt;&lt;FONT color="#a31515" size="2" face="Consolas"&gt;"Please place all the sheet under the this path C:\x and create an empty folder under the C:\1 that drawings will be placed in"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;Dim&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt; direc &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;As&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;String&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt; = &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#a31515" size="2" face="Consolas"&gt;&lt;FONT color="#a31515" size="2" face="Consolas"&gt;&lt;FONT color="#a31515" size="2" face="Consolas"&gt;"C:\x"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;Dim&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt; filecount &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;As&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;Integer&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt; = System.IO.&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#2b91af" size="2" face="Consolas"&gt;&lt;FONT color="#2b91af" size="2" face="Consolas"&gt;&lt;FONT color="#2b91af" size="2" face="Consolas"&gt;Directory&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;.GetFiles(direc, &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#a31515" size="2" face="Consolas"&gt;&lt;FONT color="#a31515" size="2" face="Consolas"&gt;&lt;FONT color="#a31515" size="2" face="Consolas"&gt;"*.dwg"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;).Length&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;Dim&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt; arrfile() &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;As&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;String&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt; = System.IO.&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#2b91af" size="2" face="Consolas"&gt;&lt;FONT color="#2b91af" size="2" face="Consolas"&gt;&lt;FONT color="#2b91af" size="2" face="Consolas"&gt;Directory&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;.GetFiles(direc, &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#a31515" size="2" face="Consolas"&gt;&lt;FONT color="#a31515" size="2" face="Consolas"&gt;&lt;FONT color="#a31515" size="2" face="Consolas"&gt;"*.dwg"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;Dim&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt; val &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;As&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;Integer&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt; = InputBox(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#a31515" size="2" face="Consolas"&gt;&lt;FONT color="#a31515" size="2" face="Consolas"&gt;&lt;FONT color="#a31515" size="2" face="Consolas"&gt;"Please Enter the value you want to add to the text"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;Dim&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt; adedo &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;As&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#2b91af" size="2" face="Consolas"&gt;&lt;FONT color="#2b91af" size="2" face="Consolas"&gt;&lt;FONT color="#2b91af" size="2" face="Consolas"&gt;Editor&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt; = &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#2b91af" size="2" face="Consolas"&gt;&lt;FONT color="#2b91af" size="2" face="Consolas"&gt;&lt;FONT color="#2b91af" size="2" face="Consolas"&gt;Application&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;.DocumentManager.MdiActiveDocument.Editor&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;　&lt;/P&gt;&lt;P&gt;　&lt;/P&gt;&lt;P&gt;　&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;Try&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;Dim&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt; i &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;As&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;Integer&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;= 0&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;For&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt; i = 0 &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;To &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;filecount - 1&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;Dim&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt; currentFile &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;As&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;String&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;= arrfile(i)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;Dim&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt; doc &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;As&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#2b91af" size="2" face="Consolas"&gt;&lt;FONT color="#2b91af" size="2" face="Consolas"&gt;&lt;FONT color="#2b91af" size="2" face="Consolas"&gt;Document&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt; = &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#2b91af" size="2" face="Consolas"&gt;&lt;FONT color="#2b91af" size="2" face="Consolas"&gt;&lt;FONT color="#2b91af" size="2" face="Consolas"&gt;Application&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;.DocumentManager.Open(currentFile, &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;False&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;Dim&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt; db &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;As&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#2b91af" size="2" face="Consolas"&gt;&lt;FONT color="#2b91af" size="2" face="Consolas"&gt;&lt;FONT color="#2b91af" size="2" face="Consolas"&gt;Database&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;= doc.Database&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;　&lt;/P&gt;&lt;P&gt;　&lt;/P&gt;&lt;P&gt;　&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;Dim&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt; newfil &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;As&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;String&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;= Replace(currentFile, Mid(Right(currentFile, 7), 1, 3), Mid(Right(currentFile, 7), 1, 3) + val)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;newfil = Replace(newfil,&lt;/P&gt;&lt;P&gt;&lt;FONT color="#a31515" size="2" face="Consolas"&gt;&lt;FONT color="#a31515" size="2" face="Consolas"&gt;&lt;FONT color="#a31515" size="2" face="Consolas"&gt;"C:\x\"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;, &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#a31515" size="2" face="Consolas"&gt;&lt;FONT color="#a31515" size="2" face="Consolas"&gt;&lt;FONT color="#a31515" size="2" face="Consolas"&gt;"C:\1\"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;　&lt;/P&gt;&lt;P&gt;　&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;Dim&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt; doclock &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;As&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#2b91af" size="2" face="Consolas"&gt;&lt;FONT color="#2b91af" size="2" face="Consolas"&gt;&lt;FONT color="#2b91af" size="2" face="Consolas"&gt;DocumentLock&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;= doc.LockDocument&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;Using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;doclock&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;Dim&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt; trans &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;As&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#2b91af" size="2" face="Consolas"&gt;&lt;FONT color="#2b91af" size="2" face="Consolas"&gt;&lt;FONT color="#2b91af" size="2" face="Consolas"&gt;Transaction&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;= db.TransactionManager.StartTransaction()&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;Using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;(trans)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;Dim&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt; ly1 &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;As&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#2b91af" size="2" face="Consolas"&gt;&lt;FONT color="#2b91af" size="2" face="Consolas"&gt;&lt;FONT color="#2b91af" size="2" face="Consolas"&gt;LayoutManager&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt; = &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#2b91af" size="2" face="Consolas"&gt;&lt;FONT color="#2b91af" size="2" face="Consolas"&gt;&lt;FONT color="#2b91af" size="2" face="Consolas"&gt;LayoutManager&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;.Current&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#2b91af" size="2" face="Consolas"&gt;&lt;FONT color="#2b91af" size="2" face="Consolas"&gt;&lt;FONT color="#2b91af" size="2" face="Consolas"&gt;LayoutManager&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;.Current.CurrentLayout = &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#a31515" size="2" face="Consolas"&gt;&lt;FONT color="#a31515" size="2" face="Consolas"&gt;&lt;FONT color="#a31515" size="2" face="Consolas"&gt;"Layout1"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;　&lt;/P&gt;&lt;P&gt;trans.Commit()&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;End&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;Using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;End&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;Using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;doc.Database.SaveAs(newfil,&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;True&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;, &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#2b91af" size="2" face="Consolas"&gt;&lt;FONT color="#2b91af" size="2" face="Consolas"&gt;&lt;FONT color="#2b91af" size="2" face="Consolas"&gt;DwgVersion&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;.Current, doc.Database.SecurityParameters)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;doc.CloseAndDiscard()&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;Next&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;　&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;Catch&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt; ex &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;As&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt; Autodesk.AutoCAD.Runtime.&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#2b91af" size="2" face="Consolas"&gt;&lt;FONT color="#2b91af" size="2" face="Consolas"&gt;&lt;FONT color="#2b91af" size="2" face="Consolas"&gt;Exception&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;MsgBox(ex.Message &amp;amp; vbLf &amp;amp; ex.StackTrace)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;Finally&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;MsgBox(&lt;FONT color="#a31515" size="2" face="Consolas"&gt;&lt;FONT color="#a31515" size="2" face="Consolas"&gt;&lt;FONT color="#a31515" size="2" face="Consolas"&gt;"Done"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;End&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;Try&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;End&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;Sub&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Dec 2011 16:59:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/changing-current-layout/m-p/3251940#M66364</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-12-06T16:59:41Z</dc:date>
    </item>
    <item>
      <title>Re: Changing Current Layout</title>
      <link>https://forums.autodesk.com/t5/net-forum/changing-current-layout/m-p/3252812#M66365</link>
      <description>&lt;P&gt;I assume you have this working from the posts here and in the other thread. Unless there is&amp;nbsp;more to this, you don't need the database or a&amp;nbsp;transaction.&amp;nbsp; You also don't&amp;nbsp;need an editor that&amp;nbsp;I can see.&amp;nbsp; This will do nothing if layout1 does not exist.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using &lt;FONT size="2"&gt;&lt;FONT size="2"&gt;doclock&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;LayoutManager.Current.CurrentLayout = &lt;FONT color="#a31515" size="2"&gt;&lt;FONT color="#a31515" size="2"&gt;"Layout1"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;End &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;Using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you do need&amp;nbsp;the editor, declare&amp;nbsp;it after you open the&amp;nbsp;currentfile, like "dim adedo as editor = doc.editor".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Command flags session is described in the developers guide - a&amp;nbsp;good&amp;nbsp;page to bookmark.&amp;nbsp; (&lt;A target="_blank" href="http://docs.autodesk.com/ACD/2010/ENU/AutoCAD%20.NET%20Developer's%20Guide/index.html?url=WS1a9193826455f5ff2566ffd511ff6f8c7ca-3cf7.htm,topicNumber=d0e30666"&gt;http://docs.autodesk.com/ACD/2010/ENU/AutoCAD%20.NET%20Developer's%20Guide/index.html?url=WS1a9193826455f5ff2566ffd511ff6f8c7ca-3cf7.htm,topicNumber=d0e30666&lt;/A&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you have to do more batch file processing&amp;nbsp;do a google search for&amp;nbsp;the&amp;nbsp;openfiledialog class.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Dec 2011 03:07:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/changing-current-layout/m-p/3252812#M66365</guid>
      <dc:creator>fieldguy</dc:creator>
      <dc:date>2011-12-07T03:07:09Z</dc:date>
    </item>
    <item>
      <title>Re: Changing Current Layout</title>
      <link>https://forums.autodesk.com/t5/net-forum/changing-current-layout/m-p/3253912#M66366</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do need the editor and transaction for the rest of the program, however when i added this line next to the command method it worked&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Autodesk.AutoCAD.Runtime.&lt;/P&gt;&lt;P&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;&lt;FONT color="#2b91af" size="2" face="Consolas"&gt;&lt;FONT color="#2b91af" size="2" face="Consolas"&gt;CommandFlags&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;.Session&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you have any idea what does this line do?&lt;/P&gt;&lt;P&gt;By the way the hyperlink you attached is linking to something out of what i am asking for. R u sure from this bookmark&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Tamer Mourad&lt;/P&gt;</description>
      <pubDate>Wed, 07 Dec 2011 17:11:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/changing-current-layout/m-p/3253912#M66366</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-12-07T17:11:40Z</dc:date>
    </item>
    <item>
      <title>Re: Changing Current Layout</title>
      <link>https://forums.autodesk.com/t5/net-forum/changing-current-layout/m-p/3254012#M66367</link>
      <description>&lt;P&gt;&lt;A target="_blank" href="http://docs.autodesk.com/ACD/2010/ENU/AutoCAD%20.NET%20Developer's%20Guide/index.html"&gt;http://docs.autodesk.com/ACD/2010/ENU/AutoCAD%20.NET%20Developer's%20Guide/index.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There is lots of help available on the internet.&amp;nbsp; The main idea is to search first.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Dec 2011 18:15:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/changing-current-layout/m-p/3254012#M66367</guid>
      <dc:creator>fieldguy</dc:creator>
      <dc:date>2011-12-07T18:15:33Z</dc:date>
    </item>
    <item>
      <title>Re: Changing Current Layout</title>
      <link>https://forums.autodesk.com/t5/net-forum/changing-current-layout/m-p/3254832#M66368</link>
      <description>&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Dec 2011 06:37:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/changing-current-layout/m-p/3254832#M66368</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-12-08T06:37:29Z</dc:date>
    </item>
  </channel>
</rss>

