HELP!! Cannot set any sheets to visible

C

cassidyr1

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
 
D

Dave Peterson

Just a guess.

Try moving your code to a general module and renaming the procedure to
Auto_open().
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top