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

查看:64
本文介绍了如何从 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 = "\serverInstructions"

Shell "C:WINDOWSexplorer.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天全站免登陆