Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using Application.FileDialog(msoFileDialogFolderPicker) Ayo Excel Discussion (Misc queries) 1 March 12th 08 01:01 PM
FileDialog to select file Acid-Sky Excel Discussion (Misc queries) 2 September 12th 05 06:53 PM
filedialog Norm Excel Worksheet Functions 0 July 29th 05 10:17 PM
FileDialog Help Maynard Excel Programming 0 August 4th 04 01:43 PM
FileDialog Jag Man Excel Programming 3 February 2nd 04 04:50 AM


All times are GMT +1. The time now is 06:12 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"