Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA - Check for password protection


I have written code to filesearch and then trawl the workbooks for any
comments containing a particular string.

However when the code is running, if a sheet is password-protected it
prompts.

Is there any way of checking to see if a file is PP'd without actually
trying to open it and therefore getting prompted?

code is as below:

Set oBook = oExcel.Workbooks.Open(strWkShtPathAndNme, 0, True)

CIA,
Matt.


--
MattShoreson
------------------------------------------------------------------------
MattShoreson's Profile: http://www.excelforum.com/member.php...fo&userid=3472
View this thread: http://www.excelforum.com/showthread...hreadid=480862

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA - Check for password protection


Hello Matt,

Not to my knowledge. Opening the file is what places it into Excel's
Workbook Collection. Until it is in the collection, VBA can't access
the object's properties. Add to that password protection is an internal
routine that isn't exposed outside of the Workbook. Maybe there is a way
using some other language or method, but with VBA the answer is no.

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=480862

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 469
Default VBA - Check for password protection

I went into vba propertiers and password protected. Still after f8 puts you
right back into the vba code. No request for password. Is ther something I am
missing?
Thanks

"Leith Ross" wrote:


Hello Matt,

Not to my knowledge. Opening the file is what places it into Excel's
Workbook Collection. Until it is in the collection, VBA can't access
the object's properties. Add to that password protection is an internal
routine that isn't exposed outside of the Workbook. Maybe there is a way
using some other language or method, but with VBA the answer is no.

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=480862


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default VBA - Check for password protection

Hi Curt,

After protecting the project, to activate the protection, save the workbook,
close and re-open Excel.


---
Regards,
Norman


"Curt" wrote in message
...
I went into vba propertiers and password protected. Still after f8 puts you
right back into the vba code. No request for password. Is ther something I
am
missing?
Thanks

"Leith Ross" wrote:


Hello Matt,

Not to my knowledge. Opening the file is what places it into Excel's
Workbook Collection. Until it is in the collection, VBA can't access
the object's properties. Add to that password protection is an internal
routine that isn't exposed outside of the Workbook. Maybe there is a way
using some other language or method, but with VBA the answer is no.

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile:
http://www.excelforum.com/member.php...o&userid=18465
View this thread:
http://www.excelforum.com/showthread...hreadid=480862




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default VBA - Check for password protection

Hi Curt,

close and re-open Excel.


Should have read:

close and re-open the workbook.


---
Regards,
Norman



"Norman Jones" wrote in message
...
Hi Curt,

After protecting the project, to activate the protection, save the
workbook, close and re-open Excel.


---
Regards,
Norman


"Curt" wrote in message
...
I went into vba propertiers and password protected. Still after f8 puts
you
right back into the vba code. No request for password. Is ther something
I am
missing?
Thanks

"Leith Ross" wrote:


Hello Matt,

Not to my knowledge. Opening the file is what places it into Excel's
Workbook Collection. Until it is in the collection, VBA can't access
the object's properties. Add to that password protection is an internal
routine that isn't exposed outside of the Workbook. Maybe there is a way
using some other language or method, but with VBA the answer is no.

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile:
http://www.excelforum.com/member.php...o&userid=18465
View this thread:
http://www.excelforum.com/showthread...hreadid=480862








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 469
Default VBA - Check for password protection

DUHHH why didn't I think of this. Found out after posting the question.
Thanks for the reply
Curt

"Norman Jones" wrote:

Hi Curt,

close and re-open Excel.


Should have read:

close and re-open the workbook.


---
Regards,
Norman



"Norman Jones" wrote in message
...
Hi Curt,

After protecting the project, to activate the protection, save the
workbook, close and re-open Excel.


---
Regards,
Norman


"Curt" wrote in message
...
I went into vba propertiers and password protected. Still after f8 puts
you
right back into the vba code. No request for password. Is ther something
I am
missing?
Thanks

"Leith Ross" wrote:


Hello Matt,

Not to my knowledge. Opening the file is what places it into Excel's
Workbook Collection. Until it is in the collection, VBA can't access
the object's properties. Add to that password protection is an internal
routine that isn't exposed outside of the Workbook. Maybe there is a way
using some other language or method, but with VBA the answer is no.

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile:
http://www.excelforum.com/member.php...o&userid=18465
View this thread:
http://www.excelforum.com/showthread...hreadid=480862







  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 469
Default VBA - Check for password protection

DUHH ain't I the dummie
Thanks Curt

"Norman Jones" wrote:

Hi Curt,

After protecting the project, to activate the protection, save the workbook,
close and re-open Excel.


---
Regards,
Norman


"Curt" wrote in message
...
I went into vba propertiers and password protected. Still after f8 puts you
right back into the vba code. No request for password. Is ther something I
am
missing?
Thanks

"Leith Ross" wrote:


Hello Matt,

Not to my knowledge. Opening the file is what places it into Excel's
Workbook Collection. Until it is in the collection, VBA can't access
the object's properties. Add to that password protection is an internal
routine that isn't exposed outside of the Workbook. Maybe there is a way
using some other language or method, but with VBA the answer is no.

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile:
http://www.excelforum.com/member.php...o&userid=18465
View this thread:
http://www.excelforum.com/showthread...hreadid=480862





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
Password protection in macro ( Anybody can view my password in VB Sherees Excel Discussion (Misc queries) 2 January 24th 10 10:05 PM
Excel Data Protection- AKA: Sheet/Macro Password Protection Mushman(Woof!) Setting up and Configuration of Excel 0 December 29th 09 06:50 AM
Password Protection Bug spikefuzzy1 Excel Discussion (Misc queries) 2 July 21st 09 04:40 PM
PASSWORD PROTECTION JFW Excel Worksheet Functions 3 January 2nd 09 10:44 PM
password protection bruce forster Excel Programming 1 May 13th 04 05:32 PM


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