Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try changing:
Dim objFSO As Scripting.FileSystemObject Dim objFolder As Scripting.Folder Dim objSubfolder As Scripting.Folder Dim objFile As Scripting.File to Dim objFSO As Object Dim objFolder As Object Dim objSubfolder As Object Dim objFile As Object ====== An alternative is to set a reference (tools|references) to Microsoft Scripting Runtime Karen wrote: Thanks for your help anon - however is there someting else I need to include as it comes up with the error message "User-defined type not defined" - on the Dim variable declarations. Thanks Karen "anon" wrote: If you are simply looking to open every file within the folder that is Excel try; Dim objFSO As Scripting.FileSystemObject Dim objFolder As Scripting.Folder Dim objSubfolder As Scripting.Folder Dim objFile As Scripting.File Dim iRow As Long Dim istr as string Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFolder = objFSO.GetFolder("C:\test\") For Each objFile In objFolder.files If objFile.Type = "Microsoft Excel Worksheet" Then istr = objFolder.Path & "\" & objFile.Name Workbooks.Open Filename:=str else 'do nothing end if next objfile -- Dave Peterson |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
User selection of folder and open all .xls files within folder | Excel Programming | |||
"Folder Select" Dialogue - Opening multiple files from selected folder | Excel Programming | |||
Open files in folder - skip if already open | Excel Programming | |||
Open all files in a folder | Excel Programming | |||
open all files in a folder and ... | Excel Programming |