lenfilename=len(CommonDialog1.filename) for i=1 to lenfilename temp=right(commondialog1.file,i) if mid(temp,1,i)="\" then str=right(temp,len(temp)-1) exit for next
我其实写错了,正确的代码是: lenfilename=len(CommonDialog1.filename) for i=1 to lenfilename temp=right(commondialog1.file,i) if mid(temp,i,len(temp))="\" then str=right(temp,len(temp)-1) exit for next 经过试验,这段代码实现FileSystemObject对象的getBaseName()函数功能。