Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default HELP!! Cannot set any sheets to visible


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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default HELP!! Cannot set any sheets to visible

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro password-All sheets visible puiuluipui Excel Discussion (Misc queries) 4 September 15th 09 05:47 PM
Print Visible Sheets Macro Lisa C. Excel Discussion (Misc queries) 1 April 6th 09 06:08 AM
Can I copy just the visible sheets? Trefor Excel Discussion (Misc queries) 2 September 3rd 06 02:31 PM
3 sheets in workbook, but visible only one? slaya_cz Excel Discussion (Misc queries) 3 September 30th 05 01:37 PM
checking visible sheets. Scott Excel Programming 6 September 1st 03 05:21 PM


All times are GMT +1. The time now is 10:13 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"