View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Oscar Oscar is offline
external usenet poster
 
Posts: 35
Default Worksheet has to set to visible as it is not visible after saving and closing Excel by VB.


Hi Norman,

In case that I open the file by hand, it shows the one and only sheet.
In case I open the file by VB :

dim objExcel as Excel.Workbook
Set objExcel = GetObject(pathFile)

and set the application.visible to true by

objExcel.Application.Visible = True

I can't see any sheet. However, the sheet is there since I am able to
process it in VB and also print.
I think that the problem origin is right when opening the file by VB, since
it doesn't show any sheet after loading

Oscar




"Norman Jones" schreef in bericht
...
Hi Oscar,

Perhaps I am missing something but how can the sole sheet be hidden, as a
workbook must have at least one sheet visible?

Does the workbook contain sheets other than worksheets, e.g. a chart
sheet.?

Alternatively, is it perhaps the workbook which is hidden?


---
Regards,
Norman



"Oscar" wrote in message
ll.nl...
Hi bhofsetz,

Since the workbook is created by another program on the fly, I can't
adress these methods.
Anyway I've tested the option to set the visible property to True right
before closing but that didn't help.



"bhofsetz"
schreef in bericht
...

You could add a Workbook _Open event procedure that will set the
visibility of that worksheet to true.

Private Sub Workbook_Open()
Sheets("Put Worksheet Name Here").Visible = True
End Sub

Or you could set the visibility of the worksheet before saving and
closing.

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Sheets("Put Worksheet Name Here").Visible = True
End Sub

Either method should give you the results you are after.

HTH


--
bhofsetz
------------------------------------------------------------------------
bhofsetz's Profile:
http://www.excelforum.com/member.php...o&userid=18807
View this thread:
http://www.excelforum.com/showthread...hreadid=380706