View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
MD MD is offline
external usenet poster
 
Posts: 9
Default FileDialog problem

In a sub I define a variable as a FileDialog and I have the MicroSoft
scripting runtime reference activated. When this is ran on Excel XP it's
fine, but on EXCEL2000 I get an error.

Does anybody know why?

Regards,
MD in Montreal

Sub DoNewFolder()
On Error GoTo Sortie
Dim fd As FileDialog
Dim strPath As String
Dim B As Integer
Dim IncludeSubfolders As Boolean
Set fd = Application.FileDialog(msoFileDialogFolderPicker)

Dim selFldr As Variant
With fd
If .Show = -1 Then
For Each selFldr In .SelectedItems

strPath = selFldr & "\"
Next selFldr
Else
If selFld = "" Then Exit Sub
End If
End With
IncludeSubfolders = False
B = MsgBox("Désirez-vous inclure les sous répertoires également?",
vbYesNo, "INVENTAIRE DES RÉPERTOIRES")

If B = 6 Then
IncludeSubfolders = True
Else
IncludeSubfolders = False
End If
Range("c11").Select
Application.ScreenUpdating = False
Application.Workbooks.Open Filename:=Lecteur +
"\Mam97\metrique\rapport\export Inventaire.xls", ReadOnly:=True

With Range("A1")
.Formula = "Inventaire du Répertoi " & strPath
End With
Range("A3").Formula = " "
Range("B3").Formula = "Fichier"
Range("C3").Formula = "Mofifié le"
Range("D3").Formula = "Taille"
Range("A3:D3").Font.Bold = True
Range("A:A").Font.Bold = True
Columns("C:D").Select
With Selection
.HorizontalAlignment = xlRight
End With

ListFilesInFolder strPath, IncludeSubfolders
Range("A2").Select
ActiveWindow.SelectedSheets.PrintPreview
Application.DisplayAlerts = False
ActiveWorkbook.Close
Sortie:
End Sub