yaoqiyang 发表于 2003-11-10 19:25:00

用vb加载一个vba程序

我想用vb程序打开cad后,利用vb来加载vba程序,该怎么办啊??????
急!!!!!!!!!!!!!!!!!

iwzw 发表于 2003-11-10 20:15:00

efan2000 发表于 2003-11-10 20:29:00

使用LoadDVB。

Sub Example_LoadDVB()
    ' This example loads a DVB file into AutoCAD the VBA system and runs a macro
    ' contained in the file using the RunMacro method.
    '
    ' For this example, use one of the sample files installed
    ' with the system, so the file name may
    ' have to be modified.
    '
    ' * Note: If the he drawline DVB is already open, there will be an error
    ' when trying to unload the drawline DVB.

    Dim FileName As String
   
    FileName = "c:\program files\autocad\sample\vba\drawline.dvb"
   
    ' Load a sample VBA project DVB file
    LoadDVB FileName
   
    ' Run the drawline sample macro
    RunMacro "Module1.Drawline"
   
    ' Unload the drawline VBA project DVB file now.
    UnloadDVB FileName
   
    MsgBox "We just loaded, ran, and unloaded a VBA sample from code!"
End Sub

mccad 发表于 2003-11-10 20:42:00

注意对于VB,引用了AutoCAD后,LoadDVB和UnloadDVB必须使用
acadApp.LoadDVB和acadApp.UnloadDVB才行。

yaoqiyang 发表于 2003-11-11 09:19:00

谢谢,但是这样加载后,在VBA管理器中还是没有相应的vba应用程序?很奇怪!:)
页: [1]
查看完整版本: 用vb加载一个vba程序