SSSSS Posted February 15, 2021 Posted February 15, 2021 Hi everyone, I have an excel panel schedule that would like to data link to CAD with a macro button in excel. If destinated CAD file is opened, when I clicked macro button, it will direct me to the CAD and ask me to pick the location to paste the panel schedule. The panel schedule would be data linked to the excel. Thanks. Quote
PeterPan9720 Posted February 15, 2021 Posted February 15, 2021 15 hours ago, SSSSS said: Hi everyone, I have an excel panel schedule that would like to data link to CAD with a macro button in excel. If destinated CAD file is opened, when I clicked macro button, it will direct me to the CAD and ask me to pick the location to paste the panel schedule. The panel schedule would be data linked to the excel. Thanks. You should modify the path for open a new template. See picture below, you have to create a command button in excel, assign the macro below, and try. 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 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.