如何获取VBA中当前工作表的路径? [英] How to get the path of current worksheet in VBA?

查看:686
本文介绍了如何获取VBA中当前工作表的路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在中写了一个 add =的宏。而且我需要获取正在执行的当前工作表的路径。我该怎么做?如何获取文件路径(只是目录)?

解决方案

使用 Application.ActiveWorkbook.Path 仅用于路径本身(没有工作簿名称)或 Application.ActiveWorkbook.FullName 用于路径工作簿名字。


I wrote a macro as an add=in. And I need to get the path of the current worksheet on which it is being executed. How do I do this? How do I get the file path (just the directory)?

解决方案

Use Application.ActiveWorkbook.Path for just the path itself (without the workbook name) or Application.ActiveWorkbook.FullName for the path with the workbook name.

这篇关于如何获取VBA中当前工作表的路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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