Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hello, I hope I can explain this! Here goes - I have a VB app that creates an xls file from a template xlt file. I adds in some sheets into the xlt file and then perform a save as t save the file as an xls file. Then I have some 'clever' VBA code tha hides all of the sheets on save apart from a warning page. On open th the workbook_open runs a macro to make all the sheets visible. So, when I open the file in xl XP, there is no problem - i.e. the macr runs and then the sheets are made visible, great. The problem, is however, with excel 97!! The macro runs and sets al the sheets using:- ThisWorkbook.Sheets(sName).Visible = xlSheetVisible (sName comes from a hidden sheet) The code runs through the sheets to be made visible (held on the abov mentioned hidden sheet) and then sets the value to be - (xlSheetHidden). Unfortunatley it doesn't actually change the valu AND it doesn't give any error - it just does nothing?! How can thi be?!! Oddly, if I can run the workbook_open event manually from the VB edito and it all works?! Bizarrely, if I delete the sheets that have come from my VB app, sav and close then the macro works fine on open. If anyone has any thoughts they would be greatly appreciated! Thanks!!! Richar -- cassidyr ----------------------------------------------------------------------- cassidyr1's Profile: http://www.excelforum.com/member.php...nfo&userid=734 View this thread: http://www.excelforum.com/showthread.php?threadid=27250 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Just a guess.
Try moving your code to a general module and renaming the procedure to Auto_open(). cassidyr1 wrote: Hello, I hope I can explain this! Here goes - I have a VB app that creates an xls file from a template xlt file. It adds in some sheets into the xlt file and then perform a save as to save the file as an xls file. Then I have some 'clever' VBA code that hides all of the sheets on save apart from a warning page. On open the the workbook_open runs a macro to make all the sheets visible. So, when I open the file in xl XP, there is no problem - i.e. the macro runs and then the sheets are made visible, great. The problem, is however, with excel 97!! The macro runs and sets all the sheets using:- ThisWorkbook.Sheets(sName).Visible = xlSheetVisible (sName comes from a hidden sheet) The code runs through the sheets to be made visible (held on the above mentioned hidden sheet) and then sets the value to be -1 (xlSheetHidden). Unfortunatley it doesn't actually change the value AND it doesn't give any error - it just does nothing?! How can this be?!! Oddly, if I can run the workbook_open event manually from the VB editor and it all works?! Bizarrely, if I delete the sheets that have come from my VB app, save and close then the macro works fine on open. If anyone has any thoughts they would be greatly appreciated! Thanks!!! Richard -- cassidyr1 ------------------------------------------------------------------------ cassidyr1's Profile: http://www.excelforum.com/member.php...fo&userid=7349 View this thread: http://www.excelforum.com/showthread...hreadid=272507 -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro password-All sheets visible | Excel Discussion (Misc queries) | |||
Print Visible Sheets Macro | Excel Discussion (Misc queries) | |||
Can I copy just the visible sheets? | Excel Discussion (Misc queries) | |||
3 sheets in workbook, but visible only one? | Excel Discussion (Misc queries) | |||
checking visible sheets. | Excel Programming |