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: 16
Default Visible=false

I'm trying to speed up the macro and not show each screen and workbook as it
opens.

I've got the following code, this user group created for me, to make a data
list of path, filename and sheet names of numerous files within a folder.
The macro switches between the data page and the new workbook being
investigated. I'm trying to not show all this bouncing back and forth. I've
tried Application.ScreenUpdating = False and ActiveWindow.Visible = False but
cannot figure out where to insert or which one to use.

I appreicate, as always, any help you might be able to provide. Happy New
Year

Option Explicit
Sub ProcessAll()

Const sPath As String = "C:\Documents and Settings\gejones\Desktop\Updated
Equipment_impact files\"

Dim wb As Workbook, i As Integer
With ThisWorkbook.Sheets("Data")
.Cells.Clear
'Set up Column Headers
.Cells(1, 1) = "Path"
.Cells(1, 2) = "Folder"
.Cells(1, 3) = "Workbook"
.Cells(1, 4) = "Worksheet"
End With


With Application.FileSearch
.NewSearch
.LookIn = sPath
.SearchSubFolders = True
.Filename = "*.xls"


Application.ScreenUpdating = False
If .Execute() Then
For i = 1 To .FoundFiles.Count
Set wb = Workbooks.Open(.FoundFiles(i))
ProcessWorkbook wb
wb.Close SaveChanges:=False
Next i
End If
End With

End Sub

Sub ProcessWorkbook(oWB As Workbook)
Dim i As Long
Dim s As Worksheet
Dim d As Worksheet

Set d = ThisWorkbook.Worksheets("Data")
'sheet data has "filename" in C1, "sheetname" in D1
i = d.Cells(d.Rows.Count, 3).End(xlUp).Offset(1, 0).Row

For Each s In oWB.Worksheets
With d.Rows(i)
.Cells(1).Value = oWB.Path
.Cells(2).Value = Right(oWB.Path, Len(oWB.Path) - 73) 'you can get
the folder name from the Path
.Cells(3).Value = oWB.Name
.Cells(4).Value = s.Name
End With
i = i + 1
Next s

Windows("listing of CORONA names with macro.xls").Activate
ActiveWindow.Visible = True
Application.ScreenUpdating = True

End Sub
 
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
Application.Visible = False SimonB Setting up and Configuration of Excel 1 October 16th 06 09:51 PM
Application.Visible = False SimonB Excel Discussion (Misc queries) 1 October 15th 06 01:10 PM
Hide (visible=false) all open applications? Joe 90[_2_] Excel Programming 4 October 23rd 03 06:04 PM
Hide (visible+AD0-false) all open applications? Joe 90[_2_] Excel Programming 0 October 23rd 03 02:00 AM
Hide (visible+AD0-false) all open applications? Joe 90[_2_] Excel Programming 0 October 22nd 03 11:06 PM


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