0
我已經寫下了以下代碼,用於嘗試打開文件瀏覽器,然後將文件位置保存到文本框中。到目前爲止,我可以打開文件瀏覽器,但不能讓它的路徑保存到我的文本框中如何在對話框瀏覽器的文本框中保存文件位置
Private Sub txtImageName_Click()
Dim f As Object
Dim strFile As String
Dim strFolder As String
Dim varItem As Variant
Set f = Application.FileDialog(3)
f.AllowMultiSelect = True
If f.Show Then
For Each varItem In f.SelectedItems
strFile = Dir(varItem)
strFolder = Left(varItem, Len(varItem) - Len(strFile))
MsgBox "Folder: " & strFolder & vbCrLf & _
"File: " & strFile
Next
End If
Set f = Nothing
End Sub
這是真棒謝謝。 – Alex