First, I don't use Autocad.
But I thought that Autocad include VBA.
If that's the case, maybe you could use something like this that I use for
MSWord:
Option Explicit
Sub testme01()
Dim oWord As Object
Dim myWordTemplate As String
Dim testStr As String
myWordTemplate = "c:\msoffice\templates\1033\Elegant Fax.dot"
testStr = ""
On Error Resume Next
testStr = Dir(myWordTemplate)
On Error GoTo 0
If testStr = "" Then
MsgBox myWordTemplate & " doesn't exist"
Exit Sub
End If
On Error Resume Next
Set oWord = GetObject(, "Word.Application")
If Err Then
Set oWord = CreateObject("Word.Application")
End If
oWord.Visible = True
oWord.Documents.Add Template:=myWordTemplate
End Sub
The GetObject() stuff looks for an existing instance. If it's not found, then a
new instance is created.
The bad news is that you'll have to find out if this actually can work!
Hey!!!
From the first hit of a google search for: Automating Autocad
http://www.informit.com/articles/art...29033&seqNum=2
These two lines:
Dim A2K As AcadApplication
Dim A2Kdwg As AcadDocument
Depend on a reference (tools|References) in the excel's workbook project being
turned on.
Maybe you could use:
Dim A2K As Object
Dim A2Kdwg As Object
Riva Mario wrote:
Hi,
I want to open A.dwg and B.dwg files in different moment from VBA
excel using Shell.
I use the following line and it works right:
RetVal = Shell(GstrPercorsoCad + " " + GstrFileAorB, vbMaximizedFocus)
The point is that I want to use only one process of Autocad because in
this way the program launchs two different execution of autocad.
what can i do to open the second file in the same apllication of the
first one?
Thanks.
IL
--
Dave Peterson