zhuwy16 发表于 2006-11-23 16:30:00

APP

<P>VBA为什么不支持APP阿</P>
<P>我写的代码:</P>
<P>APP.Path &amp; "data.txt"总是报错阿??</P>

iq0050 发表于 2006-11-24 09:50:00

<P>试了一下,是不支持APP.不过用API函数能够得到当前的目录.我做了一个小的得到当前目录的VBA函数试了一下可能得到.</P>
<P>Option Explicit<BR>Private Declare Function GetCurrentDirectoryA Lib "kernel32" (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long<BR>Sub GetAppPath()<BR>&nbsp; Dim strPath As String<BR>&nbsp; Dim PathLength As Long<BR>&nbsp; strPath = Space$(1024)<BR>&nbsp; PathLength = GetCurrentDirectoryA(Len(strPath), strPath)<BR>End Sub<BR>strPath中得到的就是当前目录,就是当前dvb文件所保存的目录.</P>

zhuwy16 发表于 2006-11-25 21:12:00

<P>谢谢</P>
页: [1]
查看完整版本: APP