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: 7
Default Hide a Workbook

With this code in a macro for Excel XP in VBA, I open an 'output' document
and then it in turn opens a source document so that the cells can update. I
want to hide the source document when it opens, but leave all other Excel
files, especially the one I just opened, unhidden. Sometimes this works and
sometimes it doesn't. Could anyone tell me why, or tell me if there is a
better code to make sure I am just hiding the source document?

The code in "This Workbook" object of the 'output':

' Code Purpose: When opening output (slave) document, open main to update
the cells correctly.
Private Sub Workbook_Open()

Dim wb As Workbook
On Error Resume Next
Set wb = Workbooks("Workbook.xls")
If Not wb Is Nothing Then Exit Sub
On Error GoTo 0
' Freeze screen, no screen flickering during the running of the macro.
Application.ScreenUpdating = False
'Opening the main document:
Workbooks.Open "Workbook.xls"
'Hiding the main document:
ActiveWindow.Visible = False
Application.ScreenUpdating = True
End Sub

Thanks a lot!
--
AnthonyJ
 
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
Hide Workbook aftamath77 Excel Discussion (Misc queries) 3 October 13th 08 04:29 PM
How to hide a workbook using VBA Jeff Excel Programming 2 January 13th 05 04:13 PM
I cant hide a workbook Steve Excel Worksheet Functions 3 November 30th 04 01:05 AM
How to hide a workbook and to detect a hidden workbook in visual basic jn1971[_3_] Excel Programming 0 May 5th 04 10:08 PM
Hide a workbook Todd Huttenstine Excel Programming 2 April 28th 04 09:59 PM


All times are GMT +1. The time now is 07:00 AM.

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"