Chinaunix首页 | 论坛 | 博客
  • 博客访问: 3372831
  • 博文数量: 1575
  • 博客积分: 19423
  • 博客等级: 上将
  • 技术积分: 16102
  • 用 户 组: 普通用户
  • 注册时间: 2007-06-19 21:36
个人简介

专注专心

文章分类

全部博文(1575)

文章存档

2020年(10)

2018年(7)

2016年(6)

2015年(21)

2014年(32)

2013年(279)

2012年(516)

2011年(309)

2010年(260)

2009年(92)

2008年(15)

2007年(28)

我的朋友

分类: IT职场

2013-10-18 22:02:17

office2007停用了fileserach函数怎们办
微软建议使用DIR函数 或 fileSystemobject来实现循环打开或查询文件

Dim MyFile, MyPath, MyName
' Returns "WIN.INI" (on Microsoft Windows) if it exists.
MyFile = Dir("C:\WINDOWS\WIN.INI")    

' Returns filename with specified extension. If more than one *.ini
'
 file exists, the first file found is returned.
MyFile = Dir("C:\WINDOWS\*.INI")

' Call Dir again without arguments to return the next *.INI file in the 
'
 same directory.
MyFile = Dir

' Return first *.TXT file with a set hidden attribute.
MyFile = Dir("*.TXT", vbHidden)

' Display the names in C:\ that represent directories.
MyPath = "c:\"    ' Set the path.
MyName = Dir(MyPath, vbDirectory)    ' Retrieve the first entry.
Do While MyName <> ""    ' Start the loop.
    ' Ignore the current directory and the encompassing directory.
    If MyName <> "." And MyName <> ".." Then
        
' Use bitwise comparison to make sure MyName is a directory.
        If (GetAttr(MyPath & MyName) And vbDirectory) = vbDirectory Then
            Debug.Print MyName    
' Display entry only if it
        End If    ' it represents a directory.
    End If
    MyName 
= Dir    ' Get next entry.
Loop


参考资料:
阅读(878) | 评论(0) | 转发(0) |
0

上一篇:iphone越狱

下一篇:sap的SD, FI,MM的业务集成

给主人留下些什么吧!~~