Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 122
Default error in attempt to warn about macro security

Hi,

I have the followign code .....

Private Sub Workbook_Open()
Dim Sheet As Worksheet
For Each Sheet In Worksheets
If Sheet.Name < "waarschuwing" Then
Sheet.Visible = xlSheetHidden
End If
Next Sheet
Sheets("waarschuwing").Visible = xlSheetVeryHidden
Set Sheet = Nothing
end sub

When the code is run, i get an error message:

erro 1004
characteristic visible of class worksheet cannot be use

any ideas?
Pierre


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200511/1
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default error in attempt to warn about macro security

In any workbook there must be at least 1 visible sheet. You are trying to
hide all of the sheets which will not work...
--
HTH...

Jim Thomlinson


"Pierre via OfficeKB.com" wrote:

Hi,

I have the followign code .....

Private Sub Workbook_Open()
Dim Sheet As Worksheet
For Each Sheet In Worksheets
If Sheet.Name < "waarschuwing" Then
Sheet.Visible = xlSheetHidden
End If
Next Sheet
Sheets("waarschuwing").Visible = xlSheetVeryHidden
Set Sheet = Nothing
end sub

When the code is run, i get an error message:

erro 1004
characteristic visible of class worksheet cannot be use

any ideas?
Pierre


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200511/1

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 122
Default error in attempt to warn about macro security

Hi Jim,

thanks for replying but i do not think i am closing all the sheets.
The sheet called "waarschuwing" is still visible....

any other suggestions?
Pierre

Jim Thomlinson wrote:
In any workbook there must be at least 1 visible sheet. You are trying to
hide all of the sheets which will not work...
Hi,

[quoted text clipped - 18 lines]
any ideas?
Pierre



--
Message posted via http://www.officekb.com
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 122
Default error in attempt to warn about macro security

Hi Jim,

you were right afterall !!!
Thanks,
Pierre

P.S. i now have the right code but now i see the "warning" sheet for a few
seconds when i start the application. is there a way to not see this sheet at
all when the application starts and the macros are not disabled?
thanks,
Pierre


Jim Thomlinson wrote:
In any workbook there must be at least 1 visible sheet. You are trying to
hide all of the sheets which will not work...
Hi,

[quoted text clipped - 18 lines]
any ideas?
Pierre



--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200511/1
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 122
Default error in attempt to warn about macro security

Hi Jim,

The code works fine now, however,

on startup i still see the warning screen flashing by.
Is there a way to prevent this from happening?

I tried
Application.Screenupdating = False
DoEvents

but that did not do the trick...
any ideas?
Thanks,
Pierre

Jim Thomlinson wrote:
In any workbook there must be at least 1 visible sheet. You are trying to
hide all of the sheets which will not work...
Hi,

[quoted text clipped - 18 lines]
any ideas?
Pierre



--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200511/1


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default error in attempt to warn about macro security

In your on close hide all but the warning sheet... Whe the book is opened if
macros are disabled then no code runs and only the warning sheet is visible.
YOu will also want to use

Application.screenupdating = false
'Your code
Application.screenupdating = true 'at the end of the sub

--
HTH...

Jim Thomlinson


"Pierre via OfficeKB.com" wrote:

Hi Jim,

you were right afterall !!!
Thanks,
Pierre

P.S. i now have the right code but now i see the "warning" sheet for a few
seconds when i start the application. is there a way to not see this sheet at
all when the application starts and the macros are not disabled?
thanks,
Pierre


Jim Thomlinson wrote:
In any workbook there must be at least 1 visible sheet. You are trying to
hide all of the sheets which will not work...
Hi,

[quoted text clipped - 18 lines]
any ideas?
Pierre



--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200511/1

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default error in attempt to warn about macro security

The code doesn't execute until the workbook is opened.

You could try hiding the workbook and saving it (Like personal.xls). In
your code, you then set up the workbook the way you want to see it and then
make it visible.

In the before close event, you would need to hide it again and save it.

--
Regards,
Tom Ogilvy


"Pierre via OfficeKB.com" <u13950@uwe wrote in message
news:56bae65e5fc7d@uwe...
Hi Jim,

The code works fine now, however,

on startup i still see the warning screen flashing by.
Is there a way to prevent this from happening?

I tried
Application.Screenupdating = False
DoEvents

but that did not do the trick...
any ideas?
Thanks,
Pierre

Jim Thomlinson wrote:
In any workbook there must be at least 1 visible sheet. You are trying to
hide all of the sheets which will not work...
Hi,

[quoted text clipped - 18 lines]
any ideas?
Pierre



--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200511/1



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
how do i get excel to warn me that i already used a certain value excel warnings Excel Discussion (Misc queries) 2 January 18th 07 08:17 PM
Compile error in hidden module: security Amir Excel Programming 0 August 21st 05 01:57 AM
need an error msge when I attempt to enter a duplicate value in a pg23673 Excel Discussion (Misc queries) 5 June 13th 05 12:07 PM
Warn if already entered Pat Excel Worksheet Functions 3 February 17th 05 09:14 AM
Macro Security Error No Macro Val Steed Excel Programming 1 September 10th 03 06:58 PM


All times are GMT +1. The time now is 02:19 AM.

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

About Us

"It's about Microsoft Excel"