Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

UNHIDE an Excel workbook 1

Status
Not open for further replies.

depacho

Programmer
Aug 26, 2005
6
US
Hi I have the following code:

Code:
Dim objXLApp As Excel.Application
Dim objXLBook As Excel.workbook
Dim objXLSheet As Excel.worksheet
Dim sHeader, sFooter, sDay As String

    Set objXLBook = GetObject(sFilePath & sTableName)
    Set objXLApp = objXLBook.Parent
    
    Set objXLSheet = objXLBook.Worksheets("AE_CDSS")
    objXLSheet.PageSetup.CenterHeader = sHeader
    objXLSheet.PageSetup.CenterFooter = sFooter
    
    Set objXLSheet = objXLBook.Worksheets("CHM_CDSS_Final")
    objXLSheet.Name = "CHM_CDSS"
    objXLSheet.PageSetup.CenterHeader = sHeader
    objXLSheet.PageSetup.CenterFooter = sFooter

    Set objXLSheet = objXLBook.Worksheets("CM_CDSS")
    objXLSheet.PageSetup.CenterHeader = sHeader
    objXLSheet.PageSetup.CenterFooter = sFooter

    Set objXLSheet = objXLBook.Worksheets("HEM_CDSS_final")
    objXLSheet.Name = "HEM_CDSS"
    objXLSheet.PageSetup.CenterHeader = sHeader
    objXLSheet.PageSetup.CenterFooter = sFooter

    objXLBook.Application.Visible = True
    
    Set objXLSheet = Nothing
    Set objXLBook = Nothing
    Set objXLApp = Nothing

It just modifies (adds footer and headers ) some spreadsheet that I just exported from Access. For some reason when I open this spreadsheet, the spreadsheet doesn't appear I have to go to WINDOW and then UNHIDE and select the workbook. I have try to add HIDE = FALSE to the code but it seems that this is not an attribute. Anyone knows how to do this in VB? and why the workbook is HIDING?

Thank you
 
you may try this:
Set objXLBook = GetObject(sFilePath & sTableName)
objXLBook.Application.Visible = True
objXLBook.Windows(1).Visible = True

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thank you PH, It worked perfectly. You always so helpfull.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top