gpt4 book ai didi

VBA - SaveAs 方法的语法

转载 作者:行者123 更新时间:2023-12-04 20:14:29 29 4
gpt4 key购买 nike

实现 FileFilter 参数必须使用逗号分隔的描述器对,后跟文件扩展名。

<pre>fileName = _
Application.GetSaveAsFilename( _
InitialFileName:="my_file", _
FileFilter:="Text File (*.txt), *.txt, _
XML File (*.xml), *.xml")</pre>

我玩过这个方法。文件扩展名由括号中的扩展名决定。

那么,逗号后文件扩展名的目的是什么?
在我的代码示例 *.txt 和 *.xml 中。

最佳答案

逗号之前的一段文本是文件过滤器下拉菜单中显示的内容;逗号后的扩展名是在选择适当的菜单选项时用于过滤的实际扩展名。

在您的情况下,两个菜单选项将是 Text File (*.txt)XML File (.xml) .当他们被选中时,他们将使用 .txt.xml分别过滤可见选项。

来自 documentation :

This string passed in the FileFilter argument consists of pairs of file filter strings followed by the MS-DOS wildcard file filter specification, with each part and each pair separated by commas. Each separate pair is listed in the Files of type drop-down list box.

关于VBA - SaveAs 方法的语法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30933163/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com