打开文件夹并且选中指定的文件的通用函数
2007-09-07 18:36
330 查看
'程序设计:唐细刚 2006-4-19 At shenzhen
'函数:OpenFolderAndSelectSpecialFile
'用途:打开指定的文件夹并且选中指定的文件
'参数:szSpecialFileForSelect 想要选中的文件全路径
'返回:True:选中文件成功 False: 选中文件失败或者指定文件不存在
Public Function OpenFolderAndSelectSpecialFile(ByVal szSpecialFileForSelect As String) As Boolean
On Error GoTo hErr
If Dir(szSpecialFileForSelect) <> "" Then
Dim szShellSelect As String
szShellSelect = "Explorer /select, "
szShellSelect = szShellSelect & szSpecialFileForSelect
Shell szShellSelect, vbNormalFocus
OpenFolderAndSelectSpecialFile = True
End If
Exit Function
hErr:
End Function
'调用举例:
Private Sub Command1_Click()
Call OpenFolderAndSelectSpecialFile("C:/Program Files/Internet Explorer/IEXPLORE.EXE")
End Sub
'函数:OpenFolderAndSelectSpecialFile
'用途:打开指定的文件夹并且选中指定的文件
'参数:szSpecialFileForSelect 想要选中的文件全路径
'返回:True:选中文件成功 False: 选中文件失败或者指定文件不存在
Public Function OpenFolderAndSelectSpecialFile(ByVal szSpecialFileForSelect As String) As Boolean
On Error GoTo hErr
If Dir(szSpecialFileForSelect) <> "" Then
Dim szShellSelect As String
szShellSelect = "Explorer /select, "
szShellSelect = szShellSelect & szSpecialFileForSelect
Shell szShellSelect, vbNormalFocus
OpenFolderAndSelectSpecialFile = True
End If
Exit Function
hErr:
End Function
'调用举例:
Private Sub Command1_Click()
Call OpenFolderAndSelectSpecialFile("C:/Program Files/Internet Explorer/IEXPLORE.EXE")
End Sub
相关文章推荐
- 打开文件夹并且选中指定的文件的通用函数
- 打开文件夹并且选中指定的文件的通用函数
- 打开文件夹并且选中指定的文件的通用函数
- 打开指定文件夹并选中文件,打开指定文件 .NET实现
- 打开指定文件夹并选中文件,打开指定文件 .NET实现
- C# 打开文件夹,并同时选中指定文件
- C#中调用资源管理器(Explorer.exe)打开指定文件夹 + 并选中指定文件 + 调用(系统默认的播放类)软件(如WMP)打开(播放歌曲等)文件
- 在程序中打开文件夹,并在文件夹中选中指定的文件
- 用java打开个文件夹并选中指定文件
- 如何打开指定文件所在的文件夹并选中文件
- C# winform打开文件夹并选中指定文件
- C++打开指定文件夹,并选中文件
- Java如何打开一个文件夹并选中指定文件
- 【Unity3d】自动版本构建: 如何在Windows平台下自动打开资源管理器并且选中指定文件
- 用C++打开指定文件夹,并选中文件
- C#中调用资源管理器(Explorer.exe)打开指定文件夹 + 并选中指定文件 + 调用(系统默认的播放类)软件(如WMP)打开(播放歌曲等)文件
- 如何打开一个文件夹并选中指定文件
- C# winform打开文件夹并选中指定文件
- MFC中打开指定文件夹并默认选中该文件夹中的某个文件
- 打开一个指定的文件夹并选中里面的一个指定文件或文件夹