View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
John Wilson John Wilson is offline
external usenet poster
 
Posts: 550
Default How to run macros and make the workbooks invisible

Tom,

So I learn something new every day. <g
This, of course, is dependent on the ScreenUpdating
setting "sticking" (mentioned in another thread).
Tried your code below and it worked perfectly.
I have a few workbooks where I've tried this and it doesn't
seem to work. I'll look at them tomorrow to see what else
might be resetting the ScreenUpdating.

Thanks,
John



"Tom Ogilvy" wrote in message
...
I don't believe that you can make a single workbook invisible
when you open it from a macro.


Sub OpenWorkbookInvisibly()
Dim wkbk as Workbook
Dim sh as Worksheet
Application.ScreenUpdating = False
set wkbk = Workbooks.Open("C:\Test.xls")
for each sh in wkbk.Worksheets
sh.Activate
for each cell in sh.Range("A1:G15")
cell.Select
next
Next
wkbk.close SaveChanges:=False
Application.ScreenUpdating = True
End Sub

Put a workbook named Test.xls in your root directory and run the above.
Ever see Test.xls?

--
Regards,
Tom Ogilvy