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

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

问题描述

我编写了一个宏作为加载项,我需要获取正在执行它的当前工作表的路径.我该怎么做呢?如何获取文件路径(只是目录)?

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)?

推荐答案

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

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天全站免登陆