vb 选中文件(夹)

vb 选中文件(夹),第1张

Private Sub Command2_Click()

Shell "Explorer /select, " &"d:\"轮宏, vbNormalFocus

End Sub

上面是打开文件夹,并选中,你腊友册也可以在后面加文件告简名

Private Sub Command1_Click()

Dim a() As String, b As String

CommonDialog1.Filter = "文本文件拦神搏(*.txt)|*.txt"

CommonDialog1.InitDir = "c:\瞎首"

CommonDialog1.Flags = cdlOFNAllowMultiselect

CommonDialog1.ShowOpen

If CommonDialog1.FileName <>"" Then

a = Split(CommonDialog1.FileName, " ")

If UBound(a) >0 Then

For i = 1 To UBound(a)

b = b &a(i) &""

Next

b = Left(b, Len(b) - 1)

Else

b = Right(a(0), Len(a(0)) - InStrRev(a(0), "简祥\"))

End If

MsgBox b

End If

End Sub


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/tougao/12123210.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-21
下一篇 2023-05-21

发表评论

登录后才能评论

评论列表(0条)

保存