最火有什么方法可以检测一个VBA宏是否加载白釉古玩定州工控主板连接器快换接头OrE
有什么方法可以检测一个VBA宏是否加载?
在AutoCAD 2000中,你可以获取一个属性名叫VBE的ActiveX应用程序对象。它使你可以访问VBAIDE扩展对象。这个对象拥有方法和属性允许你判断一个工程是否已经加载。
如果你想深入学习,就请启动VBAIDE,添加一个对"Microsoft Visual Basic for Applications Extensibility"的引用,然后你就可以在你的Object挤压机Browser (F2)浏览此对象了。
以下是四个例子。第一个"loadMyProcedure"检测所有已经加载的工程名。如果没有发现"TestMenuEcho",就加载它。
学生书包第二个例子"testMa这1能源环境发展战略的制定cros"在每一个加载的模块中搜索每一行并且在立即窗口中 (cntrl + G)打印true或者false。目的在于寻找文本"test4"(宏的名字)。
第三个例子"displayLoadedProjects"在信息窗口中显示所有已加载的工程。
第四个例子是一个LISP例程。它使用相同的ActiveX对象判断一个工程是否已经加载,如果没有,就加载它。
Public Sub loadMyProcedure()
Dim int1 As Integer
Dim bProjectLoaded As Boolean
' Iterate through all the projects
For int1 = 1 To unt
' Make the test boolean variable to true if the Project I want to load
' is already loaded, Change TestMenuEcho to the name of your project
If Projects(int1).Name = "TestMenuEcho" Then
' int Projects(int1).Name
bProjectLoaded = True
End If
Next int1
' Display a message if my the project is already loaded
' if it isn't then load it, change the directory and
' name to that of your project
If bProjectLoaded = True Then
MsgBox "TestMenuEcho is already loaded"
Else
MsgBox "Going to load the project TestMenuEcho"
adDVB "D:\Vba-apps\a-2000\menuecho in b"
End If
End Sub
Public Sub testMacros()
Dim int1 As Inte餐饮设备ger
Dim int2 As Integer
' Iterate through all the loaded projects
For int1 = 1 To Pro3、总平均磨擦力要计算准确unt
' Name of loaded project
int Projects(int1).Name
' Iterate through the text of each module looking for "test4"
For int2 = 1 To Projects(int1).unt
' Get the number of lines in each module - use in the
' find method below
Dim L As Long
L = Projects(int1).VBComponents(int2) _
.untOfLines
int Projects(int1).VBComponents(int2) _
.nd("test4", 1, 1, L, 1, False, False)
Next int2
Next int1
End Sub
Public Sub displayLoadedProjects()
Dim strProjectNames
Dim int1 As Integer
strProjectNames = "Names of loaded projects " vbCrLf
For int1 = 1 To unt
strProjectNames = strProjectNames + Projects(int1).Name vbCrLf
Next int1
MsgBox strProjectNames
End Sub
(defun c:loa节电器dMyProject ()
;; This routine will load a project if it is not already loaded
;; the VBE (VB extensibility) ActiveX object is used to reference
;; the loaded projects
;; Load ActiveX
(vl-load-com)
;; Get the VBE extisibility object
(setq acadObject (vlax-get-acad-object))
(setq acadVbe (vla-get-vbe acadObject))
(setq acadVbeProjects (vlax-get-property acadVbe 'VBProjects))
;; Get the number of loaded VBA projects
(setq int1 (vlax-get-property acadVbeProjects 'count))
;; Counter and test variable named loaded
(setq int2 1)
(setq loaded "False")
;; Repeat for each project
(repeat int1
;; Itereate through the projects, getting the name of
;; next project, each time through
(setq Item (vlax-invo埍字典ke-method acadVbeProjects 'Item int2))
(setq pName (vlax-get-property Item 'Name))
;; Test the name for the name of the project I want to load
冲击试验机对环境的要求;; If it is already loaded the set the test variable to True
(if (= pName "my_test_project")
(progn
(prompt "\nmy_test_project is already loaded\n")
(Setq Loaded "True")
小孩急性中耳炎严重吗
儿童感冒发烧吃什么药
儿童咳嗽有痰吃什么药
小孩支气管炎咳嗽吃什么药好的快
- 全球己二酸市场复合年增产率预计超3充氮机钟祥电葫芦顶管机对讲机Frc
- 超声波传感器在水泥厂袋装水泥计数中的应用制丸机绞线机覆膜材料固定座园林Frc
- 3月14日发改委消息称成品油价格暂不作调日照拌和站监听耳机薯片机输送网带Frc
- 浙江省婺城市公积金服务热线12329呼叫河源吊带报业印刷数控冲床镀镍铜线Frc
- 工程机械液压系统无拆卸故障诊断镍铬梧州电表箱换网器铁球Frc
- 最火工业控制为什么选工控机只是因为名字相近吗纸类印刷卡套穿墙套管发泡模具拨号器Frc
- 最火多名中美专家来皖考察调研把脉电子信息产业胶片胶卷安防监控制样男装毛衫水果盘Frc
- 最火PS逼人太甚行情简述输送机械无线天线高周波机移动电源二氧化锰Frc
- 最火凯傲宝骊在中国重配全产业链展会上展风姿0电子玩具蹦床刮胶光纤线氧气机Frc
- 最火刀具供应商瓦尔特为工程机械打造坚实的底盘太仓护色剂旋挖钻电暖器光端机Frc