LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 117
Default Two File Dialogs

For some reason, the code below displays the file dialog twice in
a row. It shows the dialog, the user selects files, it shows the
dialog again, the user selects files, and then it writes the second
set of selections to a worksheet.

I do not understand why it displays the dialog twice. I would
appreciate any pointers.

Thanks, Alan

Sub SelectDocuments()
Const OutputFileCaption As String = _
"Please select one or more Word documents"
Dim dialog As FileDialog
Dim FileFilter As FileDialogFilters
Dim NumFiles As Integer, i As Integer
Set WBmain = GetActiveWB
Set ConfigWS = CreateConfigWS(WBmain)
ConfigWS.Activate
ConfigWS.Visible = xlSheetVisible
Set dialog = Application.FileDialog(msoFileDialogFilePicker)
With dialog
Set FileFilter = .Filters
FileFilter.Clear
FileFilter.Add "Word documents", "*.doc, *.docx"
.AllowMultiSelect = True
If .Show = 0 Then Exit Sub
NumFiles = .SelectedItems.Count
If .SelectedItems.Count 0 Then
For i = 1 To NumFiles
ConfigWS.Cells(i + 1, 2).Value = .SelectedItems.Item(i)
Next i
End If
End With
End Sub
 
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
dialogs OlieH Excel Programming 0 August 1st 07 10:42 PM
Dialogs OlieH Excel Programming 3 July 14th 07 06:58 PM
dialogs Damien Excel Programming 2 March 7th 07 09:36 PM
dialogs Damien Excel Programming 0 March 7th 07 05:35 AM
Dialogs nc Excel Discussion (Misc queries) 1 March 23rd 05 02:17 PM


All times are GMT +1. The time now is 06:21 AM.

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"