先帖一个强大的对象,能非常方便的完成系统功能! --->Shell.Application [下划线部分为参数]
Sub fu()
Set shlApp = CreateObject("Shell.Application") shlApp.CascadeWindows ' 重叠窗口 shlApp.TileHorizontally ' 横向平铺窗口 shlApp.TileVertically ' 纵向平铺窗口 shlApp.ControlPanelItem ("sysdm.cpl") ' 打开控制面板 shlApp.EjectPC ' 纵向平铺窗口 shlApp.Explore ("D:\") ' 浏览文件夹 shlApp.Open ("D:\") ' 打开文件夹 shlApp.FileRun ' 打开运行窗口 shlApp.FindComputer ' 查找计算机 shlApp.FindFiles ' 查找文件 shlApp.Help ' 系统帮助 shlApp.MinimizeAll ' 最小化窗口 shlApp.UndoMinimizeALL ' 撤消最小化窗口 shlApp.RefreshMenu ' 更新菜单 shlApp.SetTime ' 设置日期、时间 shlApp.TrayProperties ' 设置任务栏属性 shlApp.ShutdownWindows ' 关机对话框 shlApp.Suspend ' 休眠 Set oWindows = shlApp.Windows() ' 返回shlAppWindows对象 Set fFolder = shlApp.NameSpace("D:\") ' 返回所打开的"D:\"的Folder对象 Set oFolder = shlApp.BrowseForFolder(0, "请选择文件夹", 0, "D:\") ' 选择文件夹对话框 'oFolder = shlApp.BrowseForFolder(Hwnd, sTitle, iOptions [, vRootFolder])
Set shlApp = Nothing Set oWindows = Nothing Set fFolder = Nothing Set oFolder = Nothing
End Sub |