Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I got this code posted on the groups....... Sub Consolidate() With Application.FileSearch .NewSearch 'Change this to your directory .LookIn = "C:\Excel\delete these" .SearchSubFolders = False .FileType = msoFileTypeExcelWorkbooks If .Execute() 0 Then For i = 1 To .FoundFiles.Count OpenIt = MsgBox("File: " & .FoundFiles(i) & Chr(13) & _ "Do you want to include this?", vbYesNo) If OpenIt = vbYes Then Workbooks.Open .FoundFiles(i) CloseIt = vbNo If ActiveWorkbook.Worksheets.Count 1 Then CloseIt = vbYes Set myBookToClose = ActiveWorkbook End If ActiveSheet.Name = Left(ActiveWorkbook.Name, _ Len(ActiveWorkbook.Name) - 4) ActiveSheet.Move After:=ThisWorkbook.Sheets(1) If CloseIt = vbYes Then myBookToClose.Close False End If Next i Else: MsgBox "There were no files found." End If End With The problem is that directory is in a intranet using http://companyname/storesI changed the path and it did not work.. Any ideas?Thanks |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Cesar,
That is a copy of my code. If your are using an intranet, don't use the http: but use the \\ drive designation of the drive/folder, along the lines of - \\Volume\folder1\folder2\ HTH, Bernie MS Excel MVP "Cesar Zapata" wrote in message ... Hi, I got this code posted on the groups....... Sub Consolidate() With Application.FileSearch .NewSearch 'Change this to your directory .LookIn = "C:\Excel\delete these" .SearchSubFolders = False .FileType = msoFileTypeExcelWorkbooks If .Execute() 0 Then For i = 1 To .FoundFiles.Count OpenIt = MsgBox("File: " & .FoundFiles(i) & Chr(13) & _ "Do you want to include this?", vbYesNo) If OpenIt = vbYes Then Workbooks.Open .FoundFiles(i) CloseIt = vbNo If ActiveWorkbook.Worksheets.Count 1 Then CloseIt = vbYes Set myBookToClose = ActiveWorkbook End If ActiveSheet.Name = Left(ActiveWorkbook.Name, _ Len(ActiveWorkbook.Name) - 4) ActiveSheet.Move After:=ThisWorkbook.Sheets(1) If CloseIt = vbYes Then myBookToClose.Close False End If Next i Else: MsgBox "There were no files found." End If End With The problem is that directory is in a intranet using http://companyname/storesI changed the path and it did not work.. Any ideas?Thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Updating Workbooks from multiple links Workbooks | Excel Worksheet Functions | |||
Copy/ move selected data from workbooks to seperate worksheets or workbooks | Excel Worksheet Functions | |||
Display 2 formulas from source workbooks to destination workbooks | Excel Discussion (Misc queries) | |||
suddenly my excel workbooks are "shared workbooks" | Excel Discussion (Misc queries) | |||
Workbooks.Open closes other workbooks | Excel Programming |