View Full Version : Unhiding sheets


mtairhead
07-06-2007, 09:34 AM
Hi all!

Is there any way to unhide an Excel sheet from an Access mdb? I can do it in Excel, unhiding a workbook's own sheets, but I have no clue where to begin if I'm attempting it from a different file.

~Andrew

mtairhead
07-06-2007, 12:02 PM
NM...I muddled it out. It took a lot of swearing, but it's here.


Public Sub UnhideSheet()
Dim xlsApp As Object
Dim xlsBook As Object
Dim xlsSheet As Object
Dim fileName As String

fileName = fileName 'location and file of the XLS file you wish to change

Set xlsApp = CreateObject("Excel.Application")
Set xlsBook = xlsApp.Workbooks.Open(fileName)

xlsApp.Visible = True 'Set to False if you don't want to see the workbook load

'Sheets to set to visible
xlsBook.Sheets("Sheet1").Visible = True
xlsBook.Sheets("Sheet2").Visible = True
xlsBook.Sheets("Sheet3").Visible = True

'Save and quit
xlsApp.ActiveWorkbook.Save
xlsApp.Quit

boblarson
07-06-2007, 12:04 PM
Thanks for posting back with your success. If someone else finds themselves in that situation (and does a search, which is rare in itself) they will have the benefit of your swearing :)