1个回答
展开全部
Dim oDLG,i
Set oDLG = CreateObject("MSComDlg.CommonDialog")
With oDLG
.DialogTitle = "打开文件"
.FilterIndex = 1
'.flags = 512 '设置多选文件选项, 如不需要则删除此行
.MaxFileSize = 255
.ShowOpen '选择其他内容:.ShowPrinter,.ShowColor,ShowFont
'.Color=Screen.ActiveForm.ForeColor
'.ShowColor
If .FileName <> "" Then
OpenFileDlg = .FileName
msgbox OpenFileDlg,,"你选择的文件名是:"
i=instrrev(OpenFileDlg,"\")
if i>0 then OpenFileDlg=left(OpenFileDlg,i-1)
msgbox OpenFileDlg,,"你选择的文件夹是:"
End If
End With
Set oDLG = Nothing
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询