Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Type Mismatch in Auto-Open Macro

I am getting Runtime Error "13" (Type Mismatch) on the following code:
Sub WorkBook_Open()
Sheets("Install").Select
ActiveSheet.Protect password = True
Sheets("Summary").Select
End Sub
When I remove the line "ActiveSheet.Protect password = True" it clears the
message but I really need this to be done. This is happening in Office 2002
but not in Office 2000. I can run the command at any time other than opening
and it does not give the error message. Why does it just do this in the
Auto-Open macro and what can be done to fix it?
Thanks.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Type Mismatch in Auto-Open Macro

Your missing a colon:

Sub WorkBook_Open()
Sheets("Install").Select
ActiveSheet.Protect password:=True
Sheets("Summary").Select
End Sub

--
Regards,
Tom Ogilvy

"Carl Bowman" wrote in message
...
I am getting Runtime Error "13" (Type Mismatch) on the following code:
Sub WorkBook_Open()
Sheets("Install").Select
ActiveSheet.Protect password = True
Sheets("Summary").Select
End Sub
When I remove the line "ActiveSheet.Protect password = True" it clears the
message but I really need this to be done. This is happening in Office

2002
but not in Office 2000. I can run the command at any time other than

opening
and it does not give the error message. Why does it just do this in the
Auto-Open macro and what can be done to fix it?
Thanks.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 575
Default Type Mismatch in Auto-Open Macro

Carl,

The password part is meant to be a string, not a boolean value and you need
a colon in there. e.g.

ActiveSheet.Protect Password:="My Password"

I'd guess this is working on 2000 because you don't have the Option Explicit
setting on. Since the first parameter expected is the password, what you are
doing is setting a password string of "False" which is the evaluation of the
"password = True" statement.

Robin Hammond
www.enhanceddatasystems.com

"Carl Bowman" wrote in message
...
I am getting Runtime Error "13" (Type Mismatch) on the following code:
Sub WorkBook_Open()
Sheets("Install").Select
ActiveSheet.Protect password = True
Sheets("Summary").Select
End Sub
When I remove the line "ActiveSheet.Protect password = True" it clears the
message but I really need this to be done. This is happening in Office
2002
but not in Office 2000. I can run the command at any time other than
opening
and it does not give the error message. Why does it just do this in the
Auto-Open macro and what can be done to fix it?
Thanks.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Type Mismatch in Auto-Open Macro

Thanks, Tom. You have been a tremendous help!

"Tom Ogilvy" wrote:

Your missing a colon:

Sub WorkBook_Open()
Sheets("Install").Select
ActiveSheet.Protect password:=True
Sheets("Summary").Select
End Sub

--
Regards,
Tom Ogilvy

"Carl Bowman" wrote in message
...
I am getting Runtime Error "13" (Type Mismatch) on the following code:
Sub WorkBook_Open()
Sheets("Install").Select
ActiveSheet.Protect password = True
Sheets("Summary").Select
End Sub
When I remove the line "ActiveSheet.Protect password = True" it clears the
message but I really need this to be done. This is happening in Office

2002
but not in Office 2000. I can run the command at any time other than

opening
and it does not give the error message. Why does it just do this in the
Auto-Open macro and what can be done to fix it?
Thanks.




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
Type mismatch... George[_4_] Excel Discussion (Misc queries) 7 December 19th 07 12:20 PM
Error type mismatch in writing macro ub Excel Worksheet Functions 2 September 26th 07 12:48 PM
Macro error type mismatch Jurassien Excel Discussion (Misc queries) 3 February 23rd 07 08:14 PM
Visual Basic macro run time error(13) type mismatch Paul Excel Discussion (Misc queries) 0 October 25th 05 07:28 AM
Type Mismatch when creating a pivottable macro MikeC[_3_] Excel Programming 1 September 7th 04 09:35 AM


All times are GMT +1. The time now is 05:15 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"