如何从VBA在Windows资源管理器中打开文件夹? [英] How to open a folder in Windows Explorer from VBA?

查看:618
本文介绍了如何从VBA在Windows资源管理器中打开文件夹?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想单击访问表单上的一个按钮,该按钮在Windows资源管理器中打开一个文件夹.

I want to click a button on my access form that opens a folder in Windows Explorer.

在VBA中有什么方法可以做到吗?

Is there any way to do this in VBA?

推荐答案

您可以使用以下代码从vba中打开文件位置.

You can use the following code to open a file location from vba.

Dim Foldername As String
Foldername = "\\server\Instructions\"

Shell "C:\WINDOWS\explorer.exe """ & Foldername & "", vbNormalFocus

您可以将此代码用于Windows共享和本地驱动器.

You can use this code for both windows shares and local drives.

如果要最大化视图,可以将VbNormalFocus替换为VbMaximizedFocus.

VbNormalFocus can be swapper for VbMaximizedFocus if you want a maximized view.

这篇关于如何从VBA在Windows资源管理器中打开文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆