Presentation ReadOnly property error

  • Thread starter Thread starter Phil Spiby
  • Start date Start date
P

Phil Spiby

I have set up a routine to check when a presentation is being closed, and if
the presentation is not readonly I perform some administrative tasks.
However I have found that this is failing under Powerpoint 10.

The symptoms are:
if I close a non-readonly presentation but leave powerpoint running OK
if I close a readonly presentation but leave powerpoint running
OK
if I close powerpoint with a non-readonly presentation
OK
if I close powerpoint with a readonly presentation
ERROR!

The presentation.readonly value is set to msoFalse, even though the
presentation was opened in readonly mode, my code then tries to perform the
administrative tasks on a file which has been opened in readonly mode.

Private Sub myApp_PresentationClose(ByVal Pres As Presentation)
If ES_template(Pres) Then
If Not Pres.ReadOnly Then
ES_Closing.setPresentation Pres
ES_Closing.Show
End If
End If
End Sub
 
So no-one on this newsgroup is able to answer this VBA related issue?
If no-one can help me directly is there any web sites or other newsgroups
which people know of that might be able to help me?

Phil
 
It's not very clear from your post what administrative tasks you're
performing.
It might also help to know the specific error you get.

FWIW, I've noticed that PPT may hold various files open long after it's done
with them, which leaves them in a read-only state as far as the OS is
concerned.

--
Posted to news://msnews.microsoft.com
Steve Rindsberg, PPT MVP
PowerPoint FAQ - www.pptfaq.com
PPTools - www.pptools.com
===============================
 
Steve,

Thanks for responding.
The administrative tasks I am performing are to show a form offering to:
Issue the presentation to our central QA server
Save the presentation
Quit without saving the presentation

I don't actually get an error message, it's just that a presentation which
has been opened as readonly is marked as NOT being readonly during the
PresentationClose event when powerpoint is closed down. It IS marked as
readonly if just that presentation is closed.

Phil
 
Hi Phil.

Let me see if I can simplify/summarize this:

You're trapping the Presentation.Close event
The Presentation.Close event handler tests to see if the presentation is
read-only
If so, it calls another subroutine or two

The Read-Only test returns True if the presentation is read-only and a user
(or code?) closes the presentation, BUT
The Read-Only test erroneously returns False if the presentation is open
when Powerpoint closes.

Is that an accurate explanation of what you're seeing?

Have you put a break in the event handler and traced what happens when you
close PPT?


--
Posted to news://msnews.microsoft.com
Steve Rindsberg, PPT MVP
PowerPoint FAQ - www.pptfaq.com
PPTools - www.pptools.com
===============================
 
Hi Steve,

Your summary is correct.

I have not been able to put a break into the code as run (since it is loaded
as an add-in), but I have modified the code to use msgbox at a number of
points to give the value of pres.ReadOnly during the execution.
On entry to the routine ReadOnly already has the value msoFalse if
powerpoint is closed and the presentation left open.

Phil
 
Hi Steve,

I've created a small test file which shows the situation. However it seems
this group rejects attachments, So I've included the code here:

--------------------------------------------------------------
Auto_addin module:

--------------------------------------------------------------
Option Explicit

Public myEventSink As New PPTEventSink

Sub Auto_open()
Set myEventSink.myApp = Application
End Sub

Sub Auto_close()
Set myEventSink.myApp = Nothing
End Sub

--------------------------------------------------------------
PPTEventSink Class:
--------------------------------------------------------------
Option Explicit

Public WithEvents myApp As PowerPoint.Application

Private Sub myApp_PresentationClose(ByVal Pres As Presentation)
Dim tmp As String

Select Case Pres.ReadOnly
Case msoCTrue
tmp = "msoCTrue"
Case msoFalse
tmp = "msoFalse"
Case msoTriStateMixed
tmp = "msoTriStateMixed"
Case msoTriStateToggle
tmp = "msoTriStateToggle"
Case msoTrue
tmp = "msoTrue"
End Select

MsgBox "ReadOnly property set to: " & tmp, vbOKOnly, "Closing " &
Pres.name
End Sub
--------------------------------------------------------------

Load this as an add-in
Open Powerpoint
File->Open
Select a file
Open->Open Read only
Close that file the message box should report the readonly setting is
msoTrue
open the same file using the same routine
Close powerpoint the message box will report the readonly setting is
msoFalse, even though it was opened readonly!

Phil
 
Back
Top