excel中vba中用FileDialog以记事本打开文本文件
sub打开文件()Setdig=Application.FileDialog(msoFileDialogOpen)Withdig.AllowMultiSelect=Tru...
sub 打开文件()
Set dig = Application.FileDialog(msoFileDialogOpen)
With dig
.AllowMultiSelect = True
.Filters.Add "文本文件", "*.txt", 1
.InitialFileName = "g:\123\"
.InitialView = msoFileDialogViewDetails
.Title = "打开"
.Show
.Execute
End With
Set dig = Nothing
End Sub
我以用记事本来打开文本文件,但系统是默认的excel,请问如何用记事本来打开文本文件?
我想用记事本来打开文本文件,但系统是默认的excel,请问如何用记事本来打开文本文件? 展开
Set dig = Application.FileDialog(msoFileDialogOpen)
With dig
.AllowMultiSelect = True
.Filters.Add "文本文件", "*.txt", 1
.InitialFileName = "g:\123\"
.InitialView = msoFileDialogViewDetails
.Title = "打开"
.Show
.Execute
End With
Set dig = Nothing
End Sub
我以用记事本来打开文本文件,但系统是默认的excel,请问如何用记事本来打开文本文件?
我想用记事本来打开文本文件,但系统是默认的excel,请问如何用记事本来打开文本文件? 展开
1个回答
展开全部
Sub 打开文件()
With Application.FileDialog(msoFileDialogOpen)
.AllowMultiSelect = True
.Filters.Add "文本文件", "*.txt", 1
.InitialFileName = "g:\123\"
.InitialView = msoFileDialogViewDetails
.Title = "打开"
If .Show = 0 Then Exit Sub
Filename = .SelectedItems(1)
End With
Shell "notepad " & Filename, vbNormalFocus
End Sub
追问
追答
选择写入Selecteditems 应该像往弹夹里压子弹一样,后入先出.应该是这样吧,这个问题我也没深究过.
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询