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: 37
Default browse between worksheets ?

Hi,

assume you have 20 workbooks and 20 worksheet in each workbook.totally 400
worksheets.if 20 workbooks are in one folder, when below code is run, all
worksheet names ( 400 ) are written in a page.but if there is a folder in a
folder, below code cannot see the workbooks in the folder.

for example;assume you have excel files and one folder ( named sample ) in
adress C:\Documents and Settings.
below code cannot get worksheet names from the folder, how can we change the
code to browse all excel files whether they are in a folder or not ?

any expert ?



Sub GetAllWorksheetNames()
Dim i As Integer
Dim wbResults As Workbook
Dim wbCodeBook As Workbook
Dim wSheet As Worksheet
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Application.EnableEvents = False

On Error Resume Next

Set wbCodeBook = ThisWorkbook

With Application.FileSearch
.NewSearch
.LookIn = "C:\Documents and Settings" 'amend to suit
.FileType = msoFileTypeExcelWorkbooks
If .Execute 0 Then
For i = 1 To .FoundFiles.Count
Set wbResults = Workbooks.Open(.FoundFiles(i))

wbCodeBook.Sheets(1).Range _
("A65536").End(xlUp)(2, 1) = UCase(wbResults.Name)
For Each wSheet In wbResults.Worksheets
wbCodeBook.Sheets(1).Range _
("A65536").End(xlUp)(2, 1) = wSheet.Name
Next wSheet
wbResults.Close SaveChanges:=False
Next i
End If
End With

On Error GoTo 0
Application.ScreenUpdating = True
Application.DisplayAlerts = True
Application.EnableEvents = True
End Sub



--
SAHRAYICEDIT-ISTANBUL
 
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
Trying to browse Add-ins???? [email protected] Excel Discussion (Misc queries) 1 March 5th 08 08:47 PM
Browse Desktop jason2444 Excel Discussion (Misc queries) 0 August 6th 07 09:22 PM
Browse desktop jason2444 Excel Discussion (Misc queries) 0 November 29th 06 04:44 PM
Is there a way to heirarchically group worksheets, or browse them differently? [email protected] Excel Discussion (Misc queries) 2 July 18th 06 10:00 PM
Browse function Bijl167[_10_] Excel Programming 2 January 3rd 04 10:09 AM


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

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

About Us

"It's about Microsoft Excel"