Using GetObject to access a Project file but getting Error 70:Permission Denied

J

JJ

Using Project 2010..
I have some VBA code that uses GetObject and I am passing the full path name of the file to the function which is stored in a Text box on a form. For example...

Assume the Text box is named "txtFile" on a form that contains the full file name

Public Sub Test
Dim prjTest as Project

Set prjTest = GetObject(me.txtFile.Value)
prjTest.Activate

...

End Test

When the code gets to the line with the "GetObject" function, I get "Error 70: Permission Denied." However, if the actual Project file represented in the text box is open, I do NOT get the error.

How do I access the file without physically opening the file?

Do I need to enter the class name as the second argument of GetObject? If so, what IS the class name for an MS Project 2010 file?

Thanks in advance!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top