电子尺厂家
免费服务热线

Free service

hotline

010-00000000
电子尺厂家
热门搜索:
行业资讯
当前位置:首页 > 行业资讯

最火有什么方法可以检测一个VBA宏是否加载白釉古玩定州工控主板连接器快换接头OrE

发布时间:2023-11-03 22:04:00 阅读: 来源:电子尺厂家

有什么方法可以检测一个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")


小孩急性中耳炎严重吗
儿童感冒发烧吃什么药
儿童咳嗽有痰吃什么药
小孩支气管炎咳嗽吃什么药好的快