Re: Possible Project Bug: All Projects in Database are Deleted upon Save
From: Ross Herbert (ross_herbert_at_hotmail.com)
Date: 08/31/04
- Next message: venit: "Re: export to excel"
- Previous message: Bob: "Auditing Task updates"
- In reply to: Rod Gill: "Re: Possible Project Bug: All Projects in Database are Deleted upon Save"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 1 Sep 2004 09:39:39 +1000
Hi Rod,
I copied and pasted your code into a new Access DB. I changed the database
directory to D:\ only and ran the code.
Only Project1 is saved into the database. Project2 never gets there. If I
comment out the displayalerts code, I get the following message in Project:
"The file D:\Test.mpd cannot be deleted because it is open or being used by
another program."
Which is true enough if you are overwriting and not appending (Project1 is
still open as it was not asked to be closed by the code). I've been getting
the same message with my code too. Having DisplayAlerts=false just skips
the screen message.
If I were to close Project1 before saving Project2 (to avoid the message
above), then the database is automatically overwritten and Project2 ends up
being the only file in the database.
The culprit in question is Project 2002, not Project 2003. As I said
previously this problem doesn't occur in project 2000, and neither does it
appear to in 2003. It seems to be 2002 specific. 2002 is the corporate
standard where I am working and there is no question of being able to use
any of the other versions. Considering 2002 is not very old Microsoft
should be still supporting it.
I thank you for the code you presented, but as you can see I'm flummoxed
because this code should work (and mine too).
Is it possible for you to contact Microsoft over this, as I'm sure this is a
bug?
Regards, Ross
"Rod Gill" <rodsngtrap@hotmail.com> wrote in message
news:OBaaPOmjEHA.2688@TK2MSFTNGP15.phx.gbl...
> Hi,
>
> In Access when I run the following Code (with reference to Project 2003
> object library selected It runs OK. Without the displayalerts Project
> prompts with Append or overwrite message. Thankfully in Project 2003 at
> least the default is append.
>
>
> Sub test()
> Dim ProjApp As MSProject.Application
> On Error Resume Next
> Set ProjApp = GetObject(, "MSProject.Application")
> If ProjApp Is Nothing Then
> Set ProjApp = CreateObject("MSProject.Application")
> ProjApp.Visible = True
> End If
> With ProjApp
> FileNew Template:=""
> FileSaveAs Name:="<D:\@ProjectSystems\Temp\Project.mpd>\Project1",
> FormatID:="MSProject.MPD"
> FileNew Template:=""
> .DisplayAlerts = False
> FileSaveAs Name:="<D:\@ProjectSystems\Temp\Project.mpd>\Project2",
> FormatID:="MSProject.MPD"
> .DisplayAlerts = True
> End With
> Set ProjApp=Nothing
> End Sub
>
> --
> For VBA posts, please use the public.project.developer group.
> For any version of Project use public.project
> For any version of Project Server use public. project.server
>
> Rod Gill
> Project MVP
> For Microsoft Project companion projects, best practices and Project VBA
> development services
> visit www.projectlearning.com/
> "Ross Herbert" <ross_herbert@hotmail.com> wrote in message
> news:eZWkwRjjEHA.1356@TK2MSFTNGP09.phx.gbl...
> > Hello,
> >
> > This is a re-post, so I apologise for anyone who cares about such
things.
> > Except, I don't yet have an answer that resolves the problem, and on
three
> > disparate computers with a lot of testing I get exactly the same
problem.
> >
> > First: the problem didn't happen with Project 2000 - it is only
happening
> > with Project 2002 (Professional edition to be specific). Project 2002
is
> > required in my case as it is the new corporate standard.
> >
> > Second: The same VBA code (with appropriate modifications for
Automation)
> > which works in MS Project DOES NOT WORK via Access VBA.
> >
> > Third: It appears to be a rather dangerous fault in MS Project, as for
all
> I
> > can tell with my testing, anyone who tries to save to a .mpd or .mdb
> > database will unintentionally DELETE all their stored projects except
for
> > the project being saved. There is no message, no error, just a complete
> > DELETION of the current database.
> >
> > The code I am using is the rather innocuous:
> > filesaveas name:="<mydatabase.mpd>\project1", formatid:="MSProject.mpd"
> >
> > This code, rather than append the project to the database, will actually
> > delete the Database and create a new one with only the specified project
> > saved in it. I understand that there is an option with the
DisplayAlerts
> > codeword to not show messages when saving and therefore append by
default
> if
> > DisplayAlerts=false. However, DisplayAlerts doesn't appear to have any
> > affect when used from Access. In Project it correctly will allow
> APPENDING
> > of the Project to the Database. Via Access it does nothing of this kind
> and
> > Project always OVERWRITES THE ENTIRE DATABASE.
> >
> > Now, I am not exactly stupid, and I have used a lot of VBA variations,
> > recorded macros in Project, copied them over to Access with modification
> so
> > they will work, created them from scratch, scoured the help file and the
> > internet, tried different Access versions, Windows OS', etc. The point
> is,
> > a fairly simple and normal command (Save) completely destroys data and
> > having searched the internet for answers I only find blank stares. On
the
> > occasions others have found the same bug the responses have been a shrug
> of
> > shoulders. I may get the same response on this occasion too, however,
if
> > anyone knows anything can they please respond with their answer or
> > workaround.
> >
> > If no one knows anything perhaps a kind MVP could inform Microsoft.
> >
> > Thankyou, and Regards, Ross
> >
> >
>
>
- Next message: venit: "Re: export to excel"
- Previous message: Bob: "Auditing Task updates"
- In reply to: Rod Gill: "Re: Possible Project Bug: All Projects in Database are Deleted upon Save"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|