Creating CAD files using Excel.

Mushtaq86

New Member
Joined
May 7, 2017
Messages
22
Dear Folks,


Greetings of the Day !!!


I have list of file names in column B (say 50 names, 10 each of 5 different set). Admitting that I am at beginner level of VBA, I could only get through the following code to open AutoCAD application.
I looking for some modification in the code to open a template file and save as with the above 50 names at a desired location.


Any help in solving the issue will be of great help or at-least a reference to solved thread of same issue will be highly appreciated.

The same query is posted in another forum as well at the below mentioned link:
https://www.ozgrid.com/forum/forum/...cros/1206576-create-cad-files-using-excel-vba

I hope i am not breaking any rule of the forum, if any kindly guide me.


Many Thanks in advance.


Cheers !!

Code:
Dim ACAD As Object
'Dim ACAD As AcadApplication
Dim NewFile As Object
Dim MyAcadPath As String
Dim bReadOnly As Boolean


    On Error Resume Next
    Set ACAD = GetObject(, "ACAD.Application")
    If (Err <> 0) Then
        Err.Clear
        Set ACAD = CreateObject("autocad.Application")
        If (Err <> 0) Then
            MsgBox "Could Not Load AutoCAD!", vbExclamation
            End
        End If
    End If
    
    'If you want to see AutoCAD on screen
    ACAD.Visible = True
    
    MyAcadPath = "c:\Temp\Drawing2.dwg"
    bReadOnly = True
    Set NewFile = ACAD.Documents.Open(MyAcadPath, bReadOnly)
    
    If (NewFile Is Nothing) Then
ErrorMessage:
        If NewFile = "False" Then End
            MsgBox "Could not find the required spreadsheet that should be located at" & vbCr & MyAcadPath & vbCr & "Please rename or relocate the specified file as needed."
        End
    End If
    
    'Close AutoCAD Process
    ACAD.Close
    'Set ACAD = Nothing
    'Set NewFile = Nothing


End Sub
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Help for the same query is also requested at the below mentioned links

Ozgrid: https://www.ozgrid.com/forum/forum/...cros/1206576-create-cad-files-using-excel-vba

Stackoverflow: https://stackoverflow.com/questions...g-excel?noredirect=1#comment90444929_51709310

I will keep on working on the code with the help received from anyone. Once, the query is solved... threads on all the above links will be updated with the code.
Hope I am not breaking any rule or no one is getting offended.

Sincere Thanks.
 
Upvote 0

Forum statistics

Threads
1,224,827
Messages
6,181,197
Members
453,022
Latest member
RobertV1609

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top