Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Checking whether a workbook has been unlocked

I am trying to find an attribute that will allow me to check if the
currently open workbook is protected or if the user has unlocked it. I
only want a user to be able to click on a couple buttons if they've
unlocked the book.

My VBA code locks the workbook as soon as it is opened, but I want
people who know the password to be able to unlock the book and use
these buttons.

I've tried using ThisWorkbook.VBProject.Protection but I get an error
saying that Method "VBProject" of object "_Workbook" failed and I
haven't been able to find anything else in the google newsgroups.

Zach

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Checking whether a workbook has been unlocked

Define what you mean by locked. Show the code that locks the workbook.

--
Regards,
Tom Ogilvy


" wrote:

I am trying to find an attribute that will allow me to check if the
currently open workbook is protected or if the user has unlocked it. I
only want a user to be able to click on a couple buttons if they've
unlocked the book.

My VBA code locks the workbook as soon as it is opened, but I want
people who know the password to be able to unlock the book and use
these buttons.

I've tried using ThisWorkbook.VBProject.Protection but I get an error
saying that Method "VBProject" of object "_Workbook" failed and I
haven't been able to find anything else in the google newsgroups.

Zach


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Checking whether a workbook has been unlocked

Sure. I have this in the Workbook_Open() Sub.

ThisWorkbook.Protect Password:="password"

By locked, I mean password protected.

Zach


Tom Ogilvy wrote:
Define what you mean by locked. Show the code that locks the workbook.

--
Regards,
Tom Ogilvy


" wrote:

I am trying to find an attribute that will allow me to check if the
currently open workbook is protected or if the user has unlocked it. I
only want a user to be able to click on a couple buttons if they've
unlocked the book.

My VBA code locks the workbook as soon as it is opened, but I want
people who know the password to be able to unlock the book and use
these buttons.

I've tried using ThisWorkbook.VBProject.Protection but I get an error
saying that Method "VBProject" of object "_Workbook" failed and I
haven't been able to find anything else in the google newsgroups.

Zach



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Checking whether a workbook has been unlocked

If thisworkbook.ProtectStructure or thisworkbook.ProtectWindows then
msgbox "Workbook is protected"
end if

--
Regards,
Tom Ogilvy


" wrote:

Sure. I have this in the Workbook_Open() Sub.

ThisWorkbook.Protect Password:="password"

By locked, I mean password protected.

Zach


Tom Ogilvy wrote:
Define what you mean by locked. Show the code that locks the workbook.

--
Regards,
Tom Ogilvy


" wrote:

I am trying to find an attribute that will allow me to check if the
currently open workbook is protected or if the user has unlocked it. I
only want a user to be able to click on a couple buttons if they've
unlocked the book.

My VBA code locks the workbook as soon as it is opened, but I want
people who know the password to be able to unlock the book and use
these buttons.

I've tried using ThisWorkbook.VBProject.Protection but I get an error
saying that Method "VBProject" of object "_Workbook" failed and I
haven't been able to find anything else in the google newsgroups.

Zach




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Checking whether a workbook has been unlocked

Awesome. Thank you.

Zach

Tom Ogilvy wrote:
If thisworkbook.ProtectStructure or thisworkbook.ProtectWindows then
msgbox "Workbook is protected"
end if

--
Regards,
Tom Ogilvy


" wrote:

Sure. I have this in the Workbook_Open() Sub.

ThisWorkbook.Protect Password:="password"

By locked, I mean password protected.

Zach


Tom Ogilvy wrote:
Define what you mean by locked. Show the code that locks the workbook.

--
Regards,
Tom Ogilvy


" wrote:

I am trying to find an attribute that will allow me to check if the
currently open workbook is protected or if the user has unlocked it. I
only want a user to be able to click on a couple buttons if they've
unlocked the book.

My VBA code locks the workbook as soon as it is opened, but I want
people who know the password to be able to unlock the book and use
these buttons.

I've tried using ThisWorkbook.VBProject.Protection but I get an error
saying that Method "VBProject" of object "_Workbook" failed and I
haven't been able to find anything else in the google newsgroups.

Zach





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
RETRIEVE DATA FROM ANOTHER WORKBOOK BY CHECKING ON WORKBOOK DATE Joe Excel Worksheet Functions 13 May 27th 08 01:52 AM
Moving from unlocked cells to unlocked cells in an excel form Stacey Lee Excel Worksheet Functions 1 April 24th 06 08:44 PM
Checking for open workbook... Squid[_2_] Excel Programming 7 February 28th 04 01:16 AM
Checking 2 c if workbook exists DavidMc Excel Programming 4 September 5th 03 07:34 PM
Checking for Open Workbook sbharbour Excel Programming 6 August 28th 03 11:42 PM


All times are GMT +1. The time now is 07:50 PM.

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"