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: 17
Default Loop thru multiple files - Modify worksheet visible property

Can anyone share idea(s) for code that will programatically loop
through all the .xls files in a directory (path is c:\Data\DataFiles) and

1) set the Visible property for all ten worksheets in each .xls file to visible?

Here's what I've tried so far...

Option Explicit
Sub VisibleTrue()
Dim basebook As Workbook
Dim mybook As Workbook
'Dim Item As Worksheet
Dim i As Long
Application.ScreenUpdating = False
With Application.FileSearch
.NewSearch
.LookIn = "C:\Data\DataFiles\Sept"
.SearchSubFolders = False
.FileType = msoFileTypeExcelWorkbooks
If .Execute() 0 Then
Set basebook = ThisWorkbook
For i = 1 To .FoundFiles.Count
Set mybook = Workbooks.Open(.FoundFiles(i))
For Each sh In Sheets
sh.Visible = True
Next sh
Next i
End If
mybook.Close
Application.ScreenUpdating = True
End Sub

Any ideas are greatly appreciated.
 
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
Multiple Excel files visible DennisT Setting up and Configuration of Excel 2 September 30th 08 01:57 AM
Windows Visible Property - Code Help Gerry O Excel Discussion (Misc queries) 2 September 6th 07 02:44 AM
Upload multiple text files into 1 excel worksheet + put the filename as the first column in the worksheet Aster Excel Worksheet Functions 3 March 12th 06 09:58 AM
Multiple Text files into one worksheet-need help [email protected] Excel Discussion (Misc queries) 2 January 21st 06 05:09 PM
.Visible Property Jollynicechap Excel Programming 1 July 8th 03 09:06 PM


All times are GMT +1. The time now is 06:02 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"