<?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: Excel VBA  - Get selected points coordinates in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/excel-vba-get-selected-points-coordinates/m-p/10138364#M3608</link>
    <description>&lt;P&gt;Thank you for helping me!!!! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You'll try o do it in ACAD VBA?&lt;/P&gt;&lt;P&gt;I should be able to convert it to Excel VBA right? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 08 Mar 2021 10:38:12 GMT</pubDate>
    <dc:creator>cool.stuff</dc:creator>
    <dc:date>2021-03-08T10:38:12Z</dc:date>
    <item>
      <title>Excel VBA  - Get selected points coordinates</title>
      <link>https://forums.autodesk.com/t5/vba-forum/excel-vba-get-selected-points-coordinates/m-p/10133365#M3603</link>
      <description>&lt;P&gt;Hi!!!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to get the points coordinates from AutoCAD to Excel, using a Excel macro.&lt;/P&gt;&lt;P&gt;I have no experience in Excel API to acess AutoCAD data..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could someone help me please? It would save me hours of work!! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many many thanks!!! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Mar 2021 15:12:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/excel-vba-get-selected-points-coordinates/m-p/10133365#M3603</guid>
      <dc:creator>cool.stuff</dc:creator>
      <dc:date>2021-03-05T15:12:33Z</dc:date>
    </item>
    <item>
      <title>Excel VBA  - Get selected points coordinates</title>
      <link>https://forums.autodesk.com/t5/vba-forum/excel-vba-get-selected-points-coordinates/m-p/10133562#M3604</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You should modify the path for open a new template.&lt;/P&gt;&lt;P&gt;See picture below, you have to create a command button in excel, assign the macro below, and try.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Sub Macro_Cad()
    Dim acadApp As Object
'Check if AutoCAD is open.
   ' On Error Resume Next
    Set acadApp = GetObject(, "AutoCAD.Application")
    On Error GoTo 0
    
    'If AutoCAD is not opened create a new instance and make it visible.
   If acadApp Is Nothing Then
        Set acadApp = CreateObject("AutoCAD.Application")
        acadApp.Visible = True
   End If
    
    'Check if there is an active drawing.
    On Error Resume Next
    Set acadDoc = acadApp.ActiveDocument
    
    'No active drawing found. Create a new one.
    If acadDoc Is Nothing Then
        Set acadDoc = acadApp.Documents.Add("C:\Users\IO\AppData\Local\Autodesk\AutoCAD Mechanical 2021\R24.0\enu\Template\acad.dwt")
        acadApp.Visible = True
    End If
acadApp.Visible = True
MyScreenPoint = acadDoc.Utility.GetPoint(, "Select Insertion Point: ")
Range("E3").Value = MyScreenPoint(0)
Range("F3").Value = MyScreenPoint(1)
Range("G3").Value = MyScreenPoint(2)
End Sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="grobnik_0-1614961642927.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/889309iADA7799851A1CBE4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="grobnik_0-1614961642927.png" alt="grobnik_0-1614961642927.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Mar 2021 16:27:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/excel-vba-get-selected-points-coordinates/m-p/10133562#M3604</guid>
      <dc:creator>grobnik</dc:creator>
      <dc:date>2021-03-05T16:27:35Z</dc:date>
    </item>
    <item>
      <title>Re: Excel VBA  - Get selected points coordinates</title>
      <link>https://forums.autodesk.com/t5/vba-forum/excel-vba-get-selected-points-coordinates/m-p/10134067#M3605</link>
      <description>&lt;P&gt;If you want to avoid to insert path and become macro more generic, you can modify the macro as showed below.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;strTemplatePath = ThisDrawing.Application.Preferences.Files.TemplateDwgPath
Set acadDoc = acadApp.Documents.Add(strTemplatePath &amp;amp; "\acad.dwt")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Mar 2021 19:34:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/excel-vba-get-selected-points-coordinates/m-p/10134067#M3605</guid>
      <dc:creator>grobnik</dc:creator>
      <dc:date>2021-03-05T19:34:52Z</dc:date>
    </item>
    <item>
      <title>Re: Excel VBA  - Get selected points coordinates</title>
      <link>https://forums.autodesk.com/t5/vba-forum/excel-vba-get-selected-points-coordinates/m-p/10138265#M3606</link>
      <description>&lt;P&gt;Many many thanks!! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Works like a charm! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you please make it work for the current point selection?&lt;/P&gt;&lt;P&gt;I have 30 or 40 points to extract each time I have to run distance verifications, it would be awesome! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It is possible please?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many many thanks again! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Mar 2021 09:33:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/excel-vba-get-selected-points-coordinates/m-p/10138265#M3606</guid>
      <dc:creator>cool.stuff</dc:creator>
      <dc:date>2021-03-08T09:33:22Z</dc:date>
    </item>
    <item>
      <title>Re: Excel VBA  - Get selected points coordinates</title>
      <link>https://forums.autodesk.com/t5/vba-forum/excel-vba-get-selected-points-coordinates/m-p/10138356#M3607</link>
      <description>&lt;P&gt;Hi&amp;nbsp; thank you for your message.&lt;/P&gt;&lt;P&gt;I'll try, should be able to trap the selection event on autocad.&lt;/P&gt;&lt;P&gt;For above reason should be better transfer the macro on Autocad side instead inside Excel.&lt;/P&gt;&lt;P&gt;I'll try&lt;/P&gt;</description>
      <pubDate>Mon, 08 Mar 2021 10:34:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/excel-vba-get-selected-points-coordinates/m-p/10138356#M3607</guid>
      <dc:creator>grobnik</dc:creator>
      <dc:date>2021-03-08T10:34:16Z</dc:date>
    </item>
    <item>
      <title>Re: Excel VBA  - Get selected points coordinates</title>
      <link>https://forums.autodesk.com/t5/vba-forum/excel-vba-get-selected-points-coordinates/m-p/10138364#M3608</link>
      <description>&lt;P&gt;Thank you for helping me!!!! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You'll try o do it in ACAD VBA?&lt;/P&gt;&lt;P&gt;I should be able to convert it to Excel VBA right? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Mar 2021 10:38:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/excel-vba-get-selected-points-coordinates/m-p/10138364#M3608</guid>
      <dc:creator>cool.stuff</dc:creator>
      <dc:date>2021-03-08T10:38:12Z</dc:date>
    </item>
    <item>
      <title>Re: Excel VBA - Get selected points coordinates</title>
      <link>https://forums.autodesk.com/t5/vba-forum/excel-vba-get-selected-points-coordinates/m-p/10138386#M3609</link>
      <description>No it's no possibile to convert, VBA base it's more or less the same, but&lt;BR /&gt;in order to trap the event you should be in Autocad development area.&lt;BR /&gt;However I'll try.&lt;BR /&gt;</description>
      <pubDate>Mon, 08 Mar 2021 10:52:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/excel-vba-get-selected-points-coordinates/m-p/10138386#M3609</guid>
      <dc:creator>grobnik</dc:creator>
      <dc:date>2021-03-08T10:52:10Z</dc:date>
    </item>
    <item>
      <title>Re: Excel VBA  - Get selected points coordinates</title>
      <link>https://forums.autodesk.com/t5/vba-forum/excel-vba-get-selected-points-coordinates/m-p/10140300#M3610</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5952516"&gt;@cool.stuff&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;here the code revised, I created a loop and Excel row increasing until you press "ESC" on Autocad for exit from point selection.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Sub Macro_Cad()
    Dim acadApp As Object
'Check if AutoCAD is open.
   ' On Error Resume Next
    Set acadApp = GetObject(, "AutoCAD.Application")
   ' On Error GoTo 0
    
    'If AutoCAD is not opened create a new instance and make it visible.
   If acadApp Is Nothing Then
        Set acadApp = CreateObject("AutoCAD.Application")
        acadApp.Visible = True
   End If
    
    'Check if there is an active drawing.
    'On Error Resume Next
    Set acadDoc = acadApp.ActiveDocument
    
    'No active drawing found. Create a new one.
    If acadDoc Is Nothing Then
        Set acadDoc = acadApp.Documents.Add("C:\Users\IO\AppData\Local\Autodesk\AutoCAD Mechanical 2021\R24.0\enu\Template\acad.dwt")
        acadApp.Visible = True
    End If
acadApp.Visible = True
On Error Resume Next
A = 3
Here:
If Err &amp;lt;&amp;gt; 0 Then
        Err.Clear
        End
Else
    MyScreenPoint = acadDoc.Utility.GetPoint(, "Select Insertion Point: ")
    Range("E" &amp;amp; A).Value = MyScreenPoint(0)
    Range("F" &amp;amp; A).Value = MyScreenPoint(1)
    Range("G" &amp;amp; A).Value = MyScreenPoint(2)
    A = A + 1
End If
GoTo Here
End Sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me know Bye&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Mar 2021 21:41:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/excel-vba-get-selected-points-coordinates/m-p/10140300#M3610</guid>
      <dc:creator>grobnik</dc:creator>
      <dc:date>2021-03-08T21:41:11Z</dc:date>
    </item>
    <item>
      <title>Re: Excel VBA  - Get selected points coordinates</title>
      <link>https://forums.autodesk.com/t5/vba-forum/excel-vba-get-selected-points-coordinates/m-p/10141340#M3611</link>
      <description>&lt;P&gt;Your code works perfectly!!! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many many thanks!!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, in my spreadsheet it does not work (it stops after the first points). This is due to some code I've written before... If I paste your code in a new spreadsheet it works perfectly!! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Maybe this is due to the Err.. Do you have any idea please?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Again, many many thanks!!! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Mar 2021 08:42:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/excel-vba-get-selected-points-coordinates/m-p/10141340#M3611</guid>
      <dc:creator>cool.stuff</dc:creator>
      <dc:date>2021-03-09T08:42:28Z</dc:date>
    </item>
    <item>
      <title>Re: Excel VBA - Get selected points coordinates</title>
      <link>https://forums.autodesk.com/t5/vba-forum/excel-vba-get-selected-points-coordinates/m-p/10141347#M3612</link>
      <description>Hi, could you pass me your spreadsheet?? Now I have some issue with&lt;BR /&gt;Autocad, but I'll try.&lt;BR /&gt;Did you assigned macro correctly? Share a screenshot of error got&lt;BR /&gt;&lt;BR /&gt;Bye&lt;BR /&gt;</description>
      <pubDate>Tue, 09 Mar 2021 08:46:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/excel-vba-get-selected-points-coordinates/m-p/10141347#M3612</guid>
      <dc:creator>grobnik</dc:creator>
      <dc:date>2021-03-09T08:46:10Z</dc:date>
    </item>
    <item>
      <title>Re: Excel VBA - Get selected points coordinates</title>
      <link>https://forums.autodesk.com/t5/vba-forum/excel-vba-get-selected-points-coordinates/m-p/10141425#M3613</link>
      <description>&lt;P&gt;Hi!!!! Many thanks for your answer!! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would kindly give you the spreadsheet but it is from the company I work for..&lt;/P&gt;&lt;P&gt;I got no error &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;It just does not ask for more points. After the first iteration, it stops.&lt;/P&gt;&lt;P&gt;I dont know the remaining code contained in the spreadsheet..&lt;/P&gt;&lt;P&gt;As I said before, when I copy your macro to a new spreadsheet it works perfectly &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Mar 2021 09:23:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/excel-vba-get-selected-points-coordinates/m-p/10141425#M3613</guid>
      <dc:creator>cool.stuff</dc:creator>
      <dc:date>2021-03-09T09:23:08Z</dc:date>
    </item>
    <item>
      <title>Re: Excel VBA - Get selected points coordinates</title>
      <link>https://forums.autodesk.com/t5/vba-forum/excel-vba-get-selected-points-coordinates/m-p/10141866#M3614</link>
      <description>&lt;P&gt;Ok,&amp;nbsp;&lt;/P&gt;&lt;P&gt;You got no error due to there is an instruction "on error resume next" that allows you to skip the error but in the mean time you cannot have a debugging.&lt;/P&gt;&lt;P&gt;Try to use F8 function key and try to&lt;/P&gt;&lt;P&gt;run the procedure step by step pressing F8 on each instruction and try to check where is the error.&amp;nbsp;&lt;/P&gt;&lt;P&gt;With out any other element I cannot help you more.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Mar 2021 12:43:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/excel-vba-get-selected-points-coordinates/m-p/10141866#M3614</guid>
      <dc:creator>grobnik</dc:creator>
      <dc:date>2021-03-09T12:43:41Z</dc:date>
    </item>
  </channel>
</rss>

