|
以下是我对生成的生成播放列表的更改,原代码没有问题,我想在其中加入打开的默认路径,可是却绑定了这一路径,失去了灵活性,这行代码我用红颜色的自己表示,大侠看看加上怎样的代码才能实现我的愿望:代码如下
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim C&, Fd$, tmp, N&, myNames$, s$
If Target.Row <> 1 Then Exit Sub
Cancel = True
s = ".mp3.WMA.WAV.mid.OGG.APE.ACC.mp4.mp5.wkv.avi.wmv.flv.f4v.rm.rmv.dat.asf.mov.vob.3gp.ts.swf.tp.ifo.nsv.tta.as3........."
C = Target.Column
With Application.FileDialog(msoFileDialogFolderPicker)
.AllowMultiSelect = False
[color=Magenta]InitialFileName = "G:\prepare for use\歌曲\"
If .Show = -1 Then
If MsgBox("将在第 " & C & " 列生成文件列表。", vbYesNo) = vbYes Then
Fd = .SelectedItems(1)
tmp = Split(Fd, "\")
Cells(1, C) = tmp(UBound(tmp))
Cells(1, C).ClearComments
Cells(1, C).AddComment Fd
N = 1
myNames = Dir(Fd & "\*.*")
Do While myNames <> ""
If InStr(1, s, Split(myNames, ".")(1), 1) > 0 Then
N = N + 1
Cells(N, C) = myNames
End If
myNames = Dir
Loop
End If
End If
End With
End Sub
|
|