Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Excel 97
I use the below code to open files in 3 different directories. The first two open in alphabetical order (the same way they are listed in the directory). However when I use the code in the 3rd directory it seems to open the files at random. The first two directories are on a shared network, the 3rd is on my C drive. Can anyone tell me if there is something I might be missing? I really need the files to open in abc order. Any help is greatly appreciated. Thanks Valerie Private Sub OkButton1_Click() Dim objFSO As Scripting.FileSystemObject Dim objFolder As Scripting.Folder Dim objFile As Scripting.File Dim FullPath As String Dim Month As String Dim DirLoc As String Range("n1").Select Application.ScreenUpdating = False Month = ComboBox1.Text DirLoc = ComboBox3.Text FullPath = DirLoc & "\" & Month 'Gets files from the correct directory Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFolder = objFSO.GetFolder(FullPath) For Each objFile In objFolder.files 'Opens file If objFile.Type = "Microsoft Excel Worksheet" Then Workbooks.Open FileName:=objFolder.Path & "\" & objFile.Name, UpdateLinks:=True 'Prints and Exports Voc Rehab Information into the Summary Workbook Call ExportAndPrintAllSey ActiveWorkbook.Close End If Next Application.ScreenUpdating = False VocNorthForm.Hide End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
open all files in directory | Excel Discussion (Misc queries) | |||
Open files in the same directory | Excel Discussion (Misc queries) | |||
Macro - Open all word files in a directory | Excel Worksheet Functions | |||
Open files from specific directory | Excel Programming | |||
Open all files in a directory | Excel Programming |