本文介绍了从fDialog获取目录的全名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下代码.
Hi,
I have the following code.
Dim fDialog As Office.FileDialog
Dim varFile As Variant
Dim Path As String
' Set up the File Dialog.
Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
With fDialog
fDialog.AllowMultiSelect = False
fDialog.Title = "Please Select An Excel Sheet"
Clear out the current filters, and add our own.
fDialog.Filters.Clear
fDialog.Filters.Add "Excel Sheets 2003", "*.xls"
fDialog.Filters.Add "Excel Sheets 2007", "*.xlsx"
'.Filters.Add "All Files", "*.*"
' Show the dialog box. If the .Show method returns True, the
' user picked at least one file. If the .Show method returns
' False, the user clicked Cancel.
If fDialog.Show = True Then
Path = fDialog.InitialFileName
'Importing the Data From Excel Sheet to access database
Path = fDialog.InitialFileName
:在此语句中,路径一直到包含所选路径的最后一个文件夹为止,并且我想获取包括文件名在内的完整路径.
Path = fDialog.InitialFileName
: In this statement the path comes until the last folder that contains the selected path and I want to get the full path including the file name.
How can I do that?
推荐答案
这篇关于从fDialog获取目录的全名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!