VBA,电子表格,如何用按钮事件打开一个文件夹?
3个回答
展开全部
Private Sub CommandButton1_Click() Dim Obj As Object, Path1
Set Obj = CreateObject("shell.application")
Set Path1 = Obj.BrowseForFolder(0, "选择要打开的文件夹:", 0)
If Not Path1 Is Nothing Then
Obj.Open (Path1.self.Path)
End If
End Sub
Set Obj = CreateObject("shell.application")
Set Path1 = Obj.BrowseForFolder(0, "选择要打开的文件夹:", 0)
If Not Path1 Is Nothing Then
Obj.Open (Path1.self.Path)
End If
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
'Api直接看Api浏览器就可以调出来了
Sub A2()
ShellExecute Application.hwnd, "Open", "路径", "", "", vbNormalFocus
End Sub
Sub A1()
'Shell函数
Shell "Explorer " & "路径", vbNormalFocus
End Sub
'Api直接看Api浏览器就可以调出来了
Sub A2()
ShellExecute Application.hwnd, "Open", "路径", "", "", vbNormalFocus
End Sub
Sub A1()
'Shell函数
Shell "Explorer " & "路径", vbNormalFocus
End Sub
追问
我说的是打开电子表格,而且是VBA
追答
这不就是Vba了咯,VBA也不过是引用VB的
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
点击一下含有下面的函数的单元格,可用函数可以打开文件夹:
=hyperlink(文件夹地址,"需要显示的提示内容")
=hyperlink(文件夹地址,"需要显示的提示内容")
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询