Re: Document Level Event Trapping (COM Add-in)

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Mark Durrenberger (durrenm_at_yahoo.com)
Date: 02/28/05


Date: Mon, 28 Feb 2005 12:13:47 -0500

I'm using the NEW PROJECT event now and may be stuck with it...

The issue is that when someone launches project, then closes open projects
and then tries to open a new (blankk) project - a number of my routines fail
because there is no active document

NEWPROJECT fires before an active document has been created.

The behavior is different when opening Project from a doubleclick on it's
icon. Assuming you have "open previous project" turned off, Project opens a
blank document and NEWPROJECT runs fine.

WHen open previous project is turned on, no problems at all

Mark

-- 
_________________________________________________________
Mark Durrenberger, PMP
Principal, Oak Associates, Inc, www.oakinc.com
"Advancing the Theory and Practice of Project Management"
________________________________________________________
The nicest thing about NOT planning is that failure
comes as a complete surprise and is not preceded by
a period of worry and depression.
- Sir John Harvey-Jones
"Tom Winter" <tom@nospam.amosfivesix.com> wrote in message
news:uXY8vSbHFHA.2744@tk2msftngp13.phx.gbl...
> A quick thought. I believe the only way you could get the Project Open
event
> is if within VBA code saved as part of the Project itself. From a COM
Add-In
> or other program, you won't be able to do that.
>
> Also, from a quick look at the MDSN documentation, It looks like the
> Application object has Project related events form Save, Print, Close,
> Calculate. Will those work for you? It doesn't have Activate or Deactive,
> though it does have those for Windows. Also the NewProject event may work
> for Open. Again, I don't know anything about Project, so I'm just guessing
>
> For wrappers, assume you have created a wrapper class for the Project,
like
> in your first post, with the WithEvents ProjEvents variable. Then in your
> code the Application events, have something like this:
>
> Dim oWrappers as Collection
>
> Sub AppEvents_NewProject(oProject as MSProject.Project)
>
>     Dim oWrapper as ProjectWrapper
>
>     Set oWrapper.ProjEvents = oProject
>
>     oCollection.Add oWrapper
>
> End Sub
>
> This catches each new project and creates a Wrappe for it and hooks it up
to
> the project. Then each wrapper will get the events for that project.
>
> -- 
> Tom Winter
> tom@nospam.amosfivesix.com
>
> "Mark Durrenberger" <durrenm@yahoo.com> wrote in message
> news:ecUe11aHFHA.3352@TK2MSFTNGP10.phx.gbl...
> >> My guess is that you are not setting your "ProjEvents" variable to an
> > actual
> >> Project object.
> > You are correct here. I might be able to do this later (say in the
> > StartupComplete code - would that make any sense?)
> >
> > It's setting the variable to an actual project that starts
> >> generating the events.
> > So when do I do this? It would seem to make sense to do this in the OPEN
> > event which I can't trap (is this a catch 22 :-)
> >
> > There is no quick/easy way to get these events for
> >> all projects. If that's what you are looking for, you'll need to create
a
> >> "wrapper" class, like the one you already have, but create a new
instance
> > of
> >> it for each Project that's opened/created.
> >
> > I've heard of Wrappers but don't know what they are. Any quick hints?
> >
> > I hope that makes some sense.
> >> Sorry, I have no experience in Project itself.
> >
> >
> > Thanks for you thoughts, it points me in another research direction.
> >
> > Mark
> >
> >
>
>


Relevant Pages

  • Re: flock and reading file into array
    ... > 'flock' is just a wrapper for system call. ... > array, ... 'file' hides that functionality, bu it ... > opens file as well. ...
    (comp.lang.php)
  • Re: Enhanced Write filter: EwfMgrCommitFile
    ... Have you written this wrapper yet? ... EwfMgrCommitFile API to work and I am unable to do so. ... we can lose power so we might not be able to close and commit the file ... If your program just opens the file long enough to ...
    (microsoft.public.windowsxp.embedded)
  • Re: [PATCH] Delete obsolete RAW driver feature.
    ... marked for death since 2005. ... I think it would be better to replace it with a wrapper ... that forces O_DIRECT and opens the underlying block device. ...
    (Linux-Kernel)
  • Re: [PATCH] Delete obsolete RAW driver feature.
    ... marked for death since 2005. ... I think it would be better to replace it with a wrapper ... that forces O_DIRECT and opens the underlying block device. ...
    (Linux-Kernel)
  • Re: batch print
    ... Bob Jones ... problem is that each file opens the print dialogue window which must ... repeat until name of active document is 's name as ...
    (microsoft.public.mac.office.word)