在VB中有如下程序
Dim AcadDoc As AcadDocument
On Error Resume Next
Set ACADApp = CreateObject("AutoCAD.application")
If Err Then
MsgBox ("无法运行AutoCAD,请检查是否正确安装了AutoCAD!")
Unload Me
Exit Sub
End If
ACADApp.WindowState = acMax
ACADApp.Application.Documents.Open "C:\user.dwg"
Set AcadDoc = ACADApp.Application.ActiveDocument
AcadDoc.ModelSpace.Layout.ConfigName = "user.pc3"
AcadDoc.ModelSpace.Layout.StyleSheet = "user.ctb"