Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...I am so glad that I found your site, it is an excellent resource and has helped me greatly..."

Geography

Where in the world do Tek-Tips members come from?
tetsuo2030 (Programmer)
2 Aug 12 11:59
Greetings all.

I developed a form that takes data from an Access table and pushes it to MS Project. I recently came across an issue that I thought would be a simple fix: Password Protected .mpp files.

From Access, I use late-binding to create an instance of MS Project, then I open the user's file via FileOpen. This was all well and good until one guy decides to password protect his file; now the FileOpen method halts and a message box from MS Project pops up asking for the password--right in the middle of my procedure. I don't want this, so I just wanted to write a simple test: "[Is the .mpp file password protected?] If so, Msgbox "Hey, unprotect this first" Exit Sub".

I looked around on google, and the best I found was a similar test for an Excel application where the guy created a test by opening the workbook and intentionally sending it a blank password on the open args; on error '1004', MsgBox "Protected..." Exit Sub

So, I tried it with MS Project; I open and I intentionally send it a bogus password. Now the message box doesn't show up, which is good, but it doesn't error-out, which is bad. The FileOpen simply isn't happening, and none of my subsequent commands to Project work nor error either.


old code that generates password prompt (if password protected):

CODE -->

Dim appProj As Object
Dim strPATH as String
strPATH = "C:..."
Set appProj = CreateObject("MSProject.Application")
    appProj.FileOpen strPath, ReadOnly:=False, IgnoreReadOnlyRecommended:=True 

new code doesn't prompt, but doesn't error:

CODE -->

Dim appProj As Object
Dim strPATH as String
strPATH = "C:..."
Set appProj = CreateObject("MSProject.Application")
    appProj.FileOpen strPath, ReadOnly:=False, Password:="abc", WriteResPassword:="abc", IgnoreReadOnlyRecommended:=True 

Any ideas?


Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close