gpt4 book ai didi

ms-access - ms access 获取从 FileDialog 中选择的文件名

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

这是我的代码,我想知道如何选择文件名

Dim f As Object
Set f = Application.FileDialog(3)
f.AllowMultiSelect = True
If f.Show Then
For i = 1 To f.SelectedItems.Count
MsgBox f.SelectedItems(i)
Next
EndIf

最佳答案

你的意思是这样?

Sub Sample()
Dim f As Object

Set f = Application.FileDialog(3)

f.AllowMultiSelect = True

If f.Show Then
For i = 1 To f.SelectedItems.Count
MsgBox Filename(f.SelectedItems(i))
Next
End If
End Sub

Public Function Filename(ByVal strPath As String) As String
If Right$(strPath, 1) <> "\" And Len(strPath) > 0 Then
Filename = Filename(Left$(strPath, Len(strPath) - 1)) + Right$(strPath, 1)
End If
End Function

关于ms-access - ms access 获取从 FileDialog 中选择的文件名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10382792/

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