www.bcmx.net > vBA 获得当前文件路径

vBA 获得当前文件路径

If (ActiveWorkbook.Path & "\" & Replace(ActiveWorkbook.Name, ".xls", "")) = "" Then MkDir (ActiveWorkbook.Path &...

Sub s() Dim pth$ pth = ThisWorkbook.Path MsgBox "本文件的路径为:" & pthEnd Sub

发给你参考一下,网上搜的 Sub getpath() Range("A2:D1000").ClearContents On Error Resume Next Dim shell As Variant Set shell = CreateObject("Shell.Application") Set filePath = shell.BrowseForFolder(&O0, "选择文件夹", &H1 + &H10, "...

返回应用程序完整路径 Application.Path 返回当前工作薄的路径 ThisWorkbook.Path 返回当前默认文件路径: Application.DefaultFilePath Application.ActiveWorkbook.Path 只返回路径 Application.ActiveWorkbook.FullName 返回路径及工作簿文件...

打开文件如下: Workbooks.Open ("C:\对账单\对帐单.xlsx") 这里你可以把“C:\对账单\”换成你的绝对路径, 你可以用:a = ThisWorkbook.Path a = ThisWorkbook.Path Workbooks.Open ("" & a & "&" \ "&对帐单.xlsx") 来获取你当前表的绝对路径,...

可以通过ActivePresentation对象的Path属性获取路径地址 1)新建一个PPT,插入一个命令按钮,保存为PPTM格式文件。右键单击按钮,查看代码: 2)编辑按钮事件代码如下: Private Sub CommandButton1_Click() MsgBox ActivePresentation.PathEnd S...

sub t()dim strstr=ThisWorkbook.PathMsgBox Right(str, Len(str) - InStrRev(str, "\"))end sub用路径整理下就是文件夹了啊~

Sub s() On Error Resume Next Dim pth$, fn$, wb As Workbook pth = "d:\test\" '在这里输入要打开的工作簿的完整路径 fn = "a.xlsx" '在这里输入要打开的工作簿的文件名,包括扩展名 Set wb = Application.Workbooks.Open(pth & fn) If wb Is ...

应该是FullName获得路径,Name是获得文件名 MsgBox CurrentDb.FullName

给你个思路: Public Sub ds() Dim She As New Shell Dim Fo As Shell32.Folder Set Fo = She.BrowseForFolder(0, "", 0) MsgBox Fo.Items.Item.Path End Sub 记得在引用里面将这个打勾,否则会报错

网站地图

All rights reserved Powered by www.bcmx.net

copyright ©right 2010-2021。
www.bcmx.net内容来自网络,如有侵犯请联系客服。zhit325@qq.com