代碼如下:
創(chuàng)新互聯(lián)自2013年起,是專業(yè)互聯(lián)網(wǎng)技術(shù)服務(wù)公司,擁有項(xiàng)目成都網(wǎng)站設(shè)計(jì)、成都網(wǎng)站制作網(wǎng)站策劃,項(xiàng)目實(shí)施與項(xiàng)目整合能力。我們以讓每一個(gè)夢(mèng)想脫穎而出為使命,1280元靈丘做網(wǎng)站,已為上家服務(wù),為靈丘各地企業(yè)和個(gè)人服務(wù),聯(lián)系電話:18980820575
public
sub
command1_click()
msgbox“hello”
end
sub
則在form1中調(diào)用時(shí)就直接寫成:
public
sub
command1_click()
call
form2.command1_click
end
sub
前提是form2中相應(yīng)的代碼是public的而不是private的,否則調(diào)用不了
Private Function isopen() As AutoCAD.AcadApplication
Try
dim CADapp_temp AutoCAD.AcadApplication = GetObject(, "AutoCAD.Application")
return CADapp_temp
Catch ex As Exception
Return Nothing
End Try
End Function
'調(diào)用上面的函數(shù),如果為nothing表示沒(méi)有打開(kāi),否則打開(kāi)并返回對(duì)象
Process.Start(“cad主程序的路徑”,“要打開(kāi)文件的目錄”)
比如用記事本打開(kāi) c:\1.txt
Process.Start("C:\Windows\notepad.exe", "c:\1.txt")
你去查查書吧,書上挺詳細(xì)的,在這說(shuō)不好說(shuō),你先在項(xiàng)目里引用。然后 Dim acadapp As AcadApplication Dim acaddoc As AcadDocument On Error Resume Next AcadApp = GetObject(, "AutoCAD.Application") If Err.Number Then Err.Clear() AcadApp = CreateObject("AutoCAD.Application") If Err.Number Then MsgBox("不能運(yùn)行AutoCAD,請(qǐng)檢查是否安裝了AutoCAD") Exit Sub End If End If AcadApp.Visible = True '界面可視