LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default unlock and lock VBAProject


Because when I try to save the document it give's me the followin
message;
"you cannot save to this fileformat when the VBA project is protected"

here's the code;

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, _
Cancel As Boolean)

Dim MyVar

On Error GoTo EndHere

Application.ScreenUpdating = False
ActiveWorkbook.Unprotect

'my code here

Application.ScreenUpdating = True
ActiveWorkbook.Protect

Exit Sub

EndHe
MyVar = MsgBox(Text1, 16, Text2)

End Su

--
Lenny_82
-----------------------------------------------------------------------
Lenny_821's Profile: http://www.excelforum.com/member.php...fo&userid=1517
View this thread: http://www.excelforum.com/showthread.php?threadid=27556

 
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
Lock/Unlock cells BFife Excel Worksheet Functions 2 October 25th 06 03:20 PM
Lock and Unlock cells using VBA Peter Excel Discussion (Misc queries) 1 January 29th 05 02:00 PM
unlock and lock VBAProject Lenny_821[_2_] Excel Programming 2 November 5th 04 12:25 PM
Lock/Unlock problem Jim[_34_] Excel Programming 3 January 17th 04 05:36 PM
Lock / Unlock Cell Terence Excel Programming 1 September 30th 03 02:44 PM


All times are GMT +1. The time now is 03:43 AM.

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"