Dim xlapp as Excel.Application
Dim Xlbook as Excel.Workbook
Dim sheet as Excel.Worksheet
Dim Range as Excel.Range
Dim Zwcadapp as Zwcadapplication
Dim obj as Excel.oleobject
Set xlapp = New Excel.Application
' Set xlbook = xlapp. Workbooks.Add
' Set xlapp = New Excel.Application
' Set xlapp = CreateObject ("Excel.Application")
Set xlbook = xlapp. Workbooks.Add
Set xlsheet = xlbook. Worksheets.add
xlapp. Visible = True xlsheet. Cells (1, 1) = "Test" ' write content Set Range = xlsheet. Range ("B2")
Range.Select
Set obj = xlsheet. Oleobjects.add (filename:= "E:\Data\Eg\PROGRAM\MiTOP\BOTSmt.dwg", Link:=true, Displayasicon:=false)
Obj. Verb verb:=xlprimary on Error Resume Next
Set Zwcadapp = GetObject (, "zwcad.application")
If ERR Then
MsgBox ("CAD startup Error")
Exit Sub
End If
Zwcadapp. Visible = False Zwcadapp. WindowState = Acmax
Zwcadapp. Zoomextents ' can display all of the graphics so that the drawing is filled to the fullest extent zwcadapp the drawing area. Activedocument.save
Zwcadapp. Activedocument.close Zwcadapp. Quit
Set Zwcadapp = Nothing
Dim Zwcadapp as Zwcadapplication
Dim obj as Excel.oleobject
Range. Select
Set obj = objsheet. Oleobjects.add (Filename:=strfilename, Link:=true, Displayasicon:=false)
Obj. Verb verb:=xlprimary
On Error Resume Next
Set Zwcadapp = GetObject (, "zwcad.application")
If ERR Then
MsgBox ("CAD startup Error")
Exit Sub
End If
Zwcadapp. Visible = False
Zwcadapp. WindowState = Zcmax
Zwcadapp. Zoomextents ' can display all of the graphics so that the drawing is filled to the fullest extent of the drawing area
Zwcadapp. Activedocument.setvariable ("Filedia"), 0 "" "" "and" "" suppress pop-up dialog box. "
Zwcadapp. Activedocument.save
Zwcadapp. Activedocument.close
Zwcadapp. Quit
Set Zwcadapp = Nothing
With obj. ShapeRange
. Fill.Visible = MsoTrue
. Fill.solid
. Fill.ForeColor.SchemeColor = 65
. fill.transparency = # ' Transparency 100%
. Line.weight = 0.75
. Line.dashstyle = Msolinesolid
. Line.style = Msolinesingle
. Line.transparency = 0#
. Line.visible = MsoFalse
End with
If Issmt = True and IsPagesizeA3 = True Then
With obj. ShapeRange
. IncrementTop 25#
End with
End if If issmt = True and isPagesizeA3 = False Then
With obj. ShapeRange
. Lockaspectratio = MsoTrue
. width = 570#
. IncrementTop 100.25
End with
End If
If issmt = False and isPagesizeA3 = True Then
With obj. ShapeRange
. Lockaspectratio = MsoTrue
. width = 588#
. IncrementLeft 229#
End with
End If
If Issmt = False and isPagesizeA3 = False Then
With obj. ShapeRange
. Lockaspectratio = MsoTrue
. width = 570#
. IncrementLeft 143#
End with
End If
VB Operation CAD