文件名不带扩展名VBA [英] File name without extension name VBA
本文介绍了文件名不带扩展名VBA的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要通过VBA获取没有扩展名的文件名。我知道 ActiveWorkbook.Name
属性,但如果用户拥有Windows属性隐藏已知文件类型的扩展名
关闭,结果我的代码将是[Name.Extension]。如何只返回Workbook的独立于Windows属性的名称?
I need to get file name without extension name by VBA. I know ActiveWorkbook.Name
property , but if user haves Windows property Hide extensions for known file types
turn off, the result of my code will be [Name.Extension]. How can I return only name of Workbook independent of windows property?
我尝试甚至 ActiveWorkbook.Application.Caption
我不能自定义此属性。
I try even ActiveWorkbook.Application.Caption
but I can't customize this property.
推荐答案
strTestString = Left(ThisWorkbook.Name, (InStrRev(ThisWorkbook.Name, ".", -1, vbTextCompare) - 1))
full信用: http://mariaevert.dk/vba/?p=162
这篇关于文件名不带扩展名VBA的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文