VB Operation CAD

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.