Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
FileDialog problem
FileDialog was not introduced until OFFICE XP/Excel 2002.
Here is a workaround: http://j-walk.com/ss/excel/tips/tip29.htm at JohnWalkenbach's site. -- Regards, Tom Ogilvy "MD" wrote in message ... 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Using Application.FileDialog(msoFileDialogFolderPicker) | Excel Discussion (Misc queries) | |||
FileDialog to select file | Excel Discussion (Misc queries) | |||
filedialog | Excel Worksheet Functions | |||
FileDialog Help | Excel Programming | |||
FileDialog | Excel Programming |