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 !!
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