I then try to do a SAVEAS on the presentation to the
location and get the error:-
Run-time error -2147467259 (80040005)
Presentation (unknown member) : Failed.
I have built a simple test in which I do
oPres.SaveAs "c:\j.ppt"
in the event and this too gives the error.
In excel this technique works!!
Ideas ?
John
"John Carlier" <jcar...@vxcompany.com> wrote in message
news:a77b01c25005$f99ade50$3bef2ecf@TKMSFTNGXA10...
Assuming that oPres contains a valid reference to a presentation, this will
work.
I'm with MikeM. I'd check to see that you have a valid reference to the
file.
Read up on the timing of the events though. There may be interaction
between the document close (of the original presentation) triggering the
event twice or some such oddity. You might try it with just Save instead of
SaveAs to eliminate that possibility.
"John Carlier" <jcar...@vxcompany.com> wrote in message
news:938601c25046$358f45f0$37ef2ecf@TKMSFTNGXA13...
> The presentation is New.
> Attached is a simple VB add-in version which causes the
> error.
> The Application pointer triggers the event and I am using
> the activepresentation.
>
> Has anyone tried to do anything like this in a com add-in?
> Has anyone done anything with this event?
> Documentation is very thin. Do you have anything on
> the "timing of events" ?
>
> In fact what I want to do is just change the location
> where PowerPoint will look to save a file, before the
> FileDialog kicks in. However all my attempts to do this
> have failed. I therefore am trying to do it for
> PowerPoint. It worked OK for Excel.
>
> The source of all these problems is that it does not seem
> to be possible to influence the default save location for
> PowerPoint. The common FileDialog appears to have
> different implementations for each of the Office products.
>
> Thanks for your interest.
>
> John
> >.
> >
But have you gone into PPT, set the default save location in Tools, Options,
then checked PPT's options settings in the registry? Maybe you could get
the job done by setting the right reg entries before PPT starts?
--
Steve Rindsberg PPT MVP
PPT FAQ: http://www.pptfaq.com
PPTools: http://www.pptools.com
"John Carlier" <jcar...@vxcompany.com> wrote in message
news:938601c25046$358f45f0$37ef2ecf@TKMSFTNGXA13...
> The presentation is New.
> Attached is a simple VB add-in version which causes the
> error.
> The Application pointer triggers the event and I am using
> the activepresentation.
>
> Has anyone tried to do anything like this in a com add-in?
> Has anyone done anything with this event?
> Documentation is very thin. Do you have anything on
> the "timing of events" ?
>
> In fact what I want to do is just change the location
> where PowerPoint will look to save a file, before the
> FileDialog kicks in. However all my attempts to do this
> have failed. I therefore am trying to do it for
> PowerPoint. It worked OK for Excel.
>
> The source of all these problems is that it does not seem
> to be possible to influence the default save location for
> PowerPoint. The common FileDialog appears to have
> different implementations for each of the Office products.
>
> Thanks for your interest.
>
> John
> >-----Original Message-----
> >.
> >
General point: What state do we think PPT SHOULD be in at
the time of the BeforeSave event?
My view is that we should be able to influence things at
this moment. i.e. Save locations etc etc. This is what
happens with WORD and Excel. If we can not do this what is
the point of this event ?
Would anyone from Microsoft like to comment?
John.
>.
>
I haven't worked with it so can't really be of much help here (SHYAM!!!!
Are you watching??) <g>
The Boctor book on programming Office 2000 mentions:
"If ... Powerpoint is in its sequence of closing a document and the changes
to it will be saved, the app calls the document Save event procedure AFTER
the doc Close even procedure."
and
"If PPT is in its sequence of closing a presentation and if changes ... will
be saved, the PresentationSave procedure is called after you close the
presentation's document window. The presentation, however, is still in
memory and can be manipulated. Attempting to change ... the presentation's
document window will result in an error."
--
Steve Rindsberg PPT MVP
PPT FAQ: http://www.pptfaq.com
PPTools: http://www.pptools.com
"John Carlier" <jcar...@vxcompany.com> wrote in message
news:c19001c2527f$5f798980$a4e62ecf@tkmsftngxa06...
(sorry the xp were lowercase in my original post)
John.
>.
>
--
Steve Rindsberg PPT MVP
PPT FAQ: http://www.pptfaq.com
PPTools: http://www.pptools.com
"John Carlier" <jcar...@vxcompany.com> wrote in message
news:c63a01c25310$90409950$a4e62ecf@tkmsftngxa06...
John
>.
>
"John Carlier" <jcar...@vxcompany.com> wrote in message
news:a63801c25365$20c3f270$36ef2ecf@tkmsftngxa12...
You might want to have a browse round http://www.mvps.org/skp/ (Shyam's
site) while we're waiting.
--
Steve Rindsberg PPT MVP
PPT FAQ: http://www.pptfaq.com
PPTools: http://www.pptools.com
"John Carlier" <jcar...@vxcompany.com> wrote in message
news:a63801c25365$20c3f270$36ef2ecf@tkmsftngxa12...
Shyam Pillai is our waaaaay code-savvy PPT MVP upon whom Steve calls (bows
down to) when he gets really stuck. <VBG>
--
***DO NOT POST ATTACHMENTS TO THIS NEWSGROUP***
Echo [MS PPT MVP]
http://www.echosvoice.com
Got me pegged, doesn't she?
I await the word of the master.....
John.
>.
>
PowerPoint is quite unique, it never bothers to be consistent with other
apps. Yes, what you state is a known issue however you can resort to a
workaround.
1. Trap the BeforeSave event, cancel the save.
2. In the same event start a timer for a sec delay to invoke a procedure.
3. In the procedure invoked, kill the timer and display the save as file
dialog there and get user filename. Make use of the InitialFilename property
of the dialog box to set the default folder location and file name since if
you set "D:\My location" as
the initialfilename, it will default to that folder.
4. Deactivate the event trap and perform the save.
5. Reactivate the event trap.
If you have problems in coding it. Give a yell.
--
Regards
Shyam Pillai
Handout Wizard
http://www.mvps.org/skp/how/
"John Carlier" <jcar...@vxcompany.com> wrote in message
news:a63801c25365$20c3f270$36ef2ecf@tkmsftngxa12...
Thank you for your most interesting reply.
I will try it today.
One more question though. In your reply you wrote
"...what you state is a known issue...". I would like to
know where it is known? I have tried the Microsoft sites,
Google, Altaviste etc etc. and found nothing. I would like
to know where to look in the future as this has cost a lot
of time and effort up to now.
Also is there a fix in the works from MS?
John
>.
>
>1. Trap the BeforeSave event, cancel the save.
-- Ok done, But how do I know what triggered me ?
Exit/Close/Save.... Once I cancel the event my code
becomes a "SaveAs", even if the user wants to Exit.
>2. In the same event start a timer for a sec delay to
invoke a procedure.
-- Ok added a form with timer
>3. In the procedure invoked, kill the timer and display
the save as file
>dialog there and get user filename. Make use of the
InitialFilename property
>of the dialog box to set the default folder location and
file name since if
>you set "D:\My location" as
>the initialfilename, it will default to that folder.
-- did this but our end location is in Sharepoint so when
I give the initialfilename
= "http://carliervm01/ds/documents/fold1/test.ppt" it does
not display the contents of this directory in the window.
>4. Deactivate the event trap and perform the save.
-- I did this by setting/testing a global variable. All
the code in the beforeSave is now in a IF/END IF block.
Is this what you mean be Deactivate ?
>5. Reactivate the event trap.
-- see 4
>
>If you have problems in coding it. Give a yell.
>--
-- OK this is the yell
John
Handout Wizard
http://www.mvps.org/skp/how/
"John Carlier" <jcar...@vxcompany.com> wrote in message
news:c5ca01c254a5$42d57e60$35ef2ecf@TKMSFTNGXA11...
Use an API call to create a timer to avoid the Userform. Check my site for
some code to create an API timer.
> I give the initialfilename
> = "http://carliervm01/ds/documents/fold1/test.ppt" it does
> not display the contents of this directory in the window.
Will check up for SharePoint servers and revert.
Deactivate/Activate the event trap either by a flag or literally setting it
again in code like how you initially set it up.
--
Regards
Shyam Pillai
Handout Wizard
http://www.mvps.org/skp/how/
"John Carlier" <jcar...@vxcompany.com> wrote in message
news:ebd501c254bd$cb7cc8a0$9ae62ecf@tkmsftngxa02...
> Ok I have tried your idea and in principle it works.
> It raises however a few other points which you may be able
> to help with.
> Going through your solution
>
> >1. Trap the BeforeSave event, cancel the save.
>
I have now modified my code to do the ".SaveAs" to my
SharePoint folder. If all the 'Required' fields for Profil
have been filled then it is ok. However if a required
field is missing then I get an error back.
Using PPT without my Add-in to save to the SharePoint
folder causes the profil form to be displayed.
My code is now on the third level of exception and is
becoming a mess.
My original wish is to be able to modify the default
location where PowerPoint will look to save a file to,
i.e. the initialfilename in the dialog.
Is there no other way to do this ?
John.
"John Carlier" <jcar...@vxcompany.com> wrote in message
news:e2e501c255b0$5d414980$a4e62ecf@tkmsftngxa06...
What is interesting is that I am now rebuiling the Com add-
in using VB.NET. Here I do not get the errors in PPT.
Although these are early days and the code is not yet
complete simple traps and .SAVEAS seem to work.
Has anyone build a com addin using VB.NET ?
If so what are your results?
John.
>.
>