<?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 Coping Data From One Drawing to Another in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/coping-data-from-one-drawing-to-another/m-p/1546735#M37139</link>
    <description>Hi,&lt;BR /&gt;
 I'm using this code to copy all drawing data from one drawing to another. &lt;BR /&gt;
&lt;BR /&gt;
Public Sub CopytoDrawing(FromFilename As String, ToFilename As String)&lt;BR /&gt;
&lt;BR /&gt;
Dim objAcadEntitys() As AcadEntity&lt;BR /&gt;
Dim objSS As AcadSelectionSet&lt;BR /&gt;
Dim intI As Integer&lt;BR /&gt;
Dim objEntity As AcadEntity&lt;BR /&gt;
Dim objMS As AcadModelSpace&lt;BR /&gt;
&lt;BR /&gt;
Call ToggleDrawing(FromFilename)&lt;BR /&gt;
&lt;BR /&gt;
Set objSS = Application.ActiveDocument.SelectionSets.Add("TestMike55")&lt;BR /&gt;
objSS.Select acSelectionSetAll&lt;BR /&gt;
&lt;BR /&gt;
ReDim objAcadEntitys(objSS.count - 1)&lt;BR /&gt;
&lt;BR /&gt;
For Each objEntity In objSS&lt;BR /&gt;
&lt;BR /&gt;
    If objEntity Is Nothing Then&lt;BR /&gt;
    Else&lt;BR /&gt;
&lt;BR /&gt;
        Set objAcadEntitys(intI) = objEntity&lt;BR /&gt;
&lt;BR /&gt;
    End If&lt;BR /&gt;
    &lt;BR /&gt;
  intI = intI + 1&lt;BR /&gt;
  &lt;BR /&gt;
Next objEntity&lt;BR /&gt;
&lt;BR /&gt;
Set objMS = Application.Documents.Item(ToFilename).ModelSpace&lt;BR /&gt;
Application.ActiveDocument.CopyObjects objAcadEntitys, objMS&lt;BR /&gt;
&lt;BR /&gt;
objSS.Delete&lt;BR /&gt;
&lt;BR /&gt;
End Sub&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
It works on most drawings but periodically I get a Run Time error with the message "Invalid Owner Object" and nothing is copied. Can somone please help explain why this is happening and offer ideas on what I can do to fix it.&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
Mike</description>
    <pubDate>Thu, 02 Feb 2006 16:19:08 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2006-02-02T16:19:08Z</dc:date>
    <item>
      <title>Coping Data From One Drawing to Another</title>
      <link>https://forums.autodesk.com/t5/vba-forum/coping-data-from-one-drawing-to-another/m-p/1546735#M37139</link>
      <description>Hi,&lt;BR /&gt;
 I'm using this code to copy all drawing data from one drawing to another. &lt;BR /&gt;
&lt;BR /&gt;
Public Sub CopytoDrawing(FromFilename As String, ToFilename As String)&lt;BR /&gt;
&lt;BR /&gt;
Dim objAcadEntitys() As AcadEntity&lt;BR /&gt;
Dim objSS As AcadSelectionSet&lt;BR /&gt;
Dim intI As Integer&lt;BR /&gt;
Dim objEntity As AcadEntity&lt;BR /&gt;
Dim objMS As AcadModelSpace&lt;BR /&gt;
&lt;BR /&gt;
Call ToggleDrawing(FromFilename)&lt;BR /&gt;
&lt;BR /&gt;
Set objSS = Application.ActiveDocument.SelectionSets.Add("TestMike55")&lt;BR /&gt;
objSS.Select acSelectionSetAll&lt;BR /&gt;
&lt;BR /&gt;
ReDim objAcadEntitys(objSS.count - 1)&lt;BR /&gt;
&lt;BR /&gt;
For Each objEntity In objSS&lt;BR /&gt;
&lt;BR /&gt;
    If objEntity Is Nothing Then&lt;BR /&gt;
    Else&lt;BR /&gt;
&lt;BR /&gt;
        Set objAcadEntitys(intI) = objEntity&lt;BR /&gt;
&lt;BR /&gt;
    End If&lt;BR /&gt;
    &lt;BR /&gt;
  intI = intI + 1&lt;BR /&gt;
  &lt;BR /&gt;
Next objEntity&lt;BR /&gt;
&lt;BR /&gt;
Set objMS = Application.Documents.Item(ToFilename).ModelSpace&lt;BR /&gt;
Application.ActiveDocument.CopyObjects objAcadEntitys, objMS&lt;BR /&gt;
&lt;BR /&gt;
objSS.Delete&lt;BR /&gt;
&lt;BR /&gt;
End Sub&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
It works on most drawings but periodically I get a Run Time error with the message "Invalid Owner Object" and nothing is copied. Can somone please help explain why this is happening and offer ideas on what I can do to fix it.&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
Mike</description>
      <pubDate>Thu, 02 Feb 2006 16:19:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/coping-data-from-one-drawing-to-another/m-p/1546735#M37139</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-02-02T16:19:08Z</dc:date>
    </item>
    <item>
      <title>Re: Coping Data From One Drawing to Another</title>
      <link>https://forums.autodesk.com/t5/vba-forum/coping-data-from-one-drawing-to-another/m-p/1546736#M37140</link>
      <description>I would say the drawing you get the selection set from is not being accessed &lt;BR /&gt;
by&lt;BR /&gt;
Application.ActiveDocument.CopyObjects objAcadEntitys, objMS&lt;BR /&gt;
&lt;BR /&gt;
try defining a AcadDocument FDwg variable and setting it to&lt;BR /&gt;
Set FDwg=Application.ActiveDocument&lt;BR /&gt;
then&lt;BR /&gt;
Set objSS = FDwg.SelectionSets.Add("TestMike55")&lt;BR /&gt;
finally&lt;BR /&gt;
FDwg.Activate&lt;BR /&gt;
FDwg.CopyObjects objAcadEntitys, objMS&lt;BR /&gt;
&lt;BR /&gt;
--------------------------------&lt;BR /&gt;
Joe&lt;BR /&gt;
www.Floorcad.com&lt;BR /&gt;
&lt;MBROADBE&gt; wrote in message news:5075629@discussion.autodesk.com...&lt;BR /&gt;
Hi,&lt;BR /&gt;
 I'm using this code to copy all drawing data from one drawing to another.&lt;BR /&gt;
&lt;BR /&gt;
Public Sub CopytoDrawing(FromFilename As String, ToFilename As String)&lt;BR /&gt;
&lt;BR /&gt;
Dim objAcadEntitys() As AcadEntity&lt;BR /&gt;
Dim objSS As AcadSelectionSet&lt;BR /&gt;
Dim intI As Integer&lt;BR /&gt;
Dim objEntity As AcadEntity&lt;BR /&gt;
Dim objMS As AcadModelSpace&lt;BR /&gt;
&lt;BR /&gt;
Call ToggleDrawing(FromFilename)&lt;BR /&gt;
&lt;BR /&gt;
Set objSS = Application.ActiveDocument.SelectionSets.Add("TestMike55")&lt;BR /&gt;
objSS.Select acSelectionSetAll&lt;BR /&gt;
&lt;BR /&gt;
ReDim objAcadEntitys(objSS.count - 1)&lt;BR /&gt;
&lt;BR /&gt;
For Each objEntity In objSS&lt;BR /&gt;
&lt;BR /&gt;
    If objEntity Is Nothing Then&lt;BR /&gt;
    Else&lt;BR /&gt;
&lt;BR /&gt;
        Set objAcadEntitys(intI) = objEntity&lt;BR /&gt;
&lt;BR /&gt;
    End If&lt;BR /&gt;
&lt;BR /&gt;
  intI = intI + 1&lt;BR /&gt;
&lt;BR /&gt;
Next objEntity&lt;BR /&gt;
&lt;BR /&gt;
Set objMS = Application.Documents.Item(ToFilename).ModelSpace&lt;BR /&gt;
Application.ActiveDocument.CopyObjects objAcadEntitys, objMS&lt;BR /&gt;
&lt;BR /&gt;
objSS.Delete&lt;BR /&gt;
&lt;BR /&gt;
End Sub&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
It works on most drawings but periodically I get a Run Time error with the &lt;BR /&gt;
message "Invalid Owner Object" and nothing is copied. Can somone please help &lt;BR /&gt;
explain why this is happening and offer ideas on what I can do to fix it.&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
Mike&lt;/MBROADBE&gt;</description>
      <pubDate>Fri, 03 Feb 2006 00:23:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/coping-data-from-one-drawing-to-another/m-p/1546736#M37140</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-02-03T00:23:05Z</dc:date>
    </item>
    <item>
      <title>Re: Coping Data From One Drawing to Another</title>
      <link>https://forums.autodesk.com/t5/vba-forum/coping-data-from-one-drawing-to-another/m-p/1546737#M37141</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
Thanks for the thought, but I still get an "Invalid Owner Object" error. Any other ideas?&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
Mike</description>
      <pubDate>Fri, 03 Feb 2006 16:18:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/coping-data-from-one-drawing-to-another/m-p/1546737#M37141</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-02-03T16:18:28Z</dc:date>
    </item>
    <item>
      <title>Re: Coping Data From One Drawing to Another</title>
      <link>https://forums.autodesk.com/t5/vba-forum/coping-data-from-one-drawing-to-another/m-p/1546738#M37142</link>
      <description>Mike ,&lt;BR /&gt;
&lt;BR /&gt;
Can you zip and post the drawings that causes your routine to crash , since you said it works with most drawings. This will make it easier for someone to find the cause of your problem. &lt;BR /&gt;
&lt;BR /&gt;
Also is the code you posted exact.&lt;BR /&gt;
&lt;BR /&gt;
Maximo</description>
      <pubDate>Fri, 03 Feb 2006 18:00:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/coping-data-from-one-drawing-to-another/m-p/1546738#M37142</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-02-03T18:00:41Z</dc:date>
    </item>
  </channel>
</rss>

