tukuitk 发表于 2004-11-9 13:15:00

[求助]路径问题

请问各位兄弟:


VB中可用APP.PATH得到应用程序的路径。那么,VBA中DVB文件的路径怎么得到呢?谢谢各位!!!

雪山飞狐_lzh 发表于 2004-11-9 14:26:00

看看VBE的对象模型,在VBA的帮助里

tukuitk 发表于 2004-11-10 12:10:00

版主,没有呀,我没找到,能说清楚点吗?谢谢你了!!!

yulijin608 发表于 2004-11-10 13:35:00

<P class=Heading-2>语法
<P class=syntax>object.VBE
<P class=element>object


<P class=element-desc><A href="http://www.mjtd.com/object/acad2004/idh_application_object.htm" target="_blank" >Application</A><BR>使用该属性的方法。
<P class=element>VBE


<P class=element-desc>Microsoft VBE 对象; 只读<BR>VBAIDE 扩展对象。
<P class=Heading-2>说明
<P class=body>该属性使你能通过AutoCAD 的对象模型访问 VBA IDE 对象。如果VBAIDE不可用,该属性将出现异常。例如,当acvba.arx 应用程序未加载时,VBAIDE 不可用。


<P class=body>以下的代码行将返回当前的VBA 工程名:

<PRE class=code>ThisDrawing.Application.VBE.ActiveVBProject.Description </PRE>
<P class=body> 

<PRE class=Code>Sub Example_VBE()
    ' This example uses the VBA IDE extensibility model to dynamically
    ' create a VBA subroutine. After running this example, see the first line of code
    ' in the VBA IDE code window to see a new subroutine. Then
    ' remove the new subroutine before continuing.

    Dim VBEModel As Object
    Dim newRoutine As String
   
    Set VBEModel = VBE' Get the VBE object
   
    ' Define new subroutine to be added. This could be created dynamically from user feedback.
    newRoutine = "Sub Dynamic_Procedure()" &amp; vbCrLf
    newRoutine = newRoutine &amp; vbTab &amp; "MsgBox ""New subroutine.""" &amp; vbCrLf
    newRoutine = newRoutine &amp; "End Sub" &amp; vbCrLf
   
    ' Insert new subroutine
    VBEModel.CodePanes(1).CodeModule.InsertLines 1, newRoutine
   
    MsgBox "A new subroutine was added called Dynamic_Procedure."
End Sub</PRE>
页: [1]
查看完整版本: [求助]路径问题