VB6怎么实现类似VBA这样的功能
怎么实现打开文件夹,选择文件。vba代码:
With Application.FileDialog(3)
If .Show Then For i = 1 To .SelectedItems.Count: p = p & .SelectedItems(i) & ",": Next
End With
Private Sub Form_Load() Dim a As String CommonDialog1.ShowOpen a = CommonDialog1.FileName If a <> "" Then MsgBox "你选择的文件为:" & a, 4096, "提示" Else MsgBox "你未选择文件!", 4096, "提示" End If End Sub
Dim fileDlg As Object Set fileDlg = CreateObject("") fileDlg.DialogTitle = "选择文件" fileDlg.Filter = 文本文件|*.txt|" fileDlg.FilterIndex = 2 fileDlg.Flags = cdlOFNAllowMultiselect fileDlg.ShowOpen If fileDlg.FileName <> "" Then F1$=fileDlg.FileName Else msgbox "没有选择文件" return End If