PC Review


Reply
Thread Tools Rate Thread

Assemble presentation from current show

 
 
Martin Stender
Guest
Posts: n/a
 
      7th Jun 2006
Hi all

I have a weird issue regarding assembling a new presentation from the
current running show.

I have a large presentation that references a ppa, that contains the
code below. There's a button that calls the copySlideToPresentation
sub.


The problem is, that although I specifically create the new
presentation at the 'newPath' location, it gets saved in my 'My
Documents' folder ... weird.

Here it is:

Dim thePresentation as Presentation
Public Const thePath As String = "C:\templates"
Public Const newPath As String = "C:\presentations"

Sub copySlideToTemplate()
Dim TemplateFileName As String
Dim pres As Presentation
Dim thiswin As SlideShowWindow
Dim found As Boolean
Dim i, j As Integer
Dim Item As Variant
Dim newname As String

Set thiswin = ActivePresentation.SlideShowWindow

If thePresentation Is Nothing Then
'check if we have to create a new pres.
For Each pres In Presentations
' Checking for Custom Document Properties

For Each Item In pres.CustomDocumentProperties
If Item.Name = "Something to identify these by" Then
Set thePresentation = pres
End If
Next
Next

If thePresentation Is Nothing Then
' No presentation - create new"
newName = InputBox("New presentation name", "Please type
the presentation name")
'get new name

FileCopy thePath & "\Template.pot", newPath & "\" & newName
& ".ppt"

TemplateFileName = newPath & "\" & newName & ".ppt"

Set thePresentation = Presentations.Open(TemplateFileName,
msoFalse, msoTrue, msoTrue)

thePresentation.CustomDocumentProperties.Add
Name:="Something to identify these by", LinkToContent:=False,
Type:=msoPropertyTypeBoolean, Value:=True
thePresentation.Slides(1).Layout = ppLayoutTitleOnly
thePresentation.Slides(1).Shapes(1).TextFrame.TextRange =
newname

thePresentation.Save
End If
End If

SlideShowWindows(1).View.Slide.Copy
thePresentation.Slides.Paste
thePresentation.Save
thiswin.Activate

End Sub


Any idea why the path of 'thePresentation' gets set to the 'My
Documents' folder?

Best regards
Martin

 
Reply With Quote
 
 
 
 
Steve Rindsberg
Guest
Posts: n/a
 
      7th Jun 2006
In article <(E-Mail Removed)>, Martin
Stender wrote:
> Hi all
>
> I have a weird issue regarding assembling a new presentation from the
> current running show.
>
> I have a large presentation that references a ppa, that contains the
> code below. There's a button that calls the copySlideToPresentation
> sub.
>
> The problem is, that although I specifically create the new
> presentation at the 'newPath' location, it gets saved in my 'My
> Documents' folder ... weird.
>
> Here it is:
>
> Dim thePresentation as Presentation
> Public Const thePath As String = "C:\templates"
> Public Const newPath As String = "C:\presentations"
>
> Sub copySlideToTemplate()
> Dim TemplateFileName As String
> Dim pres As Presentation
> Dim thiswin As SlideShowWindow
> Dim found As Boolean
> Dim i, j As Integer
> Dim Item As Variant
> Dim newname As String
>
> Set thiswin = ActivePresentation.SlideShowWindow
>
> If thePresentation Is Nothing Then
> 'check if we have to create a new pres.
> For Each pres In Presentations
> ' Checking for Custom Document Properties
>
> For Each Item In pres.CustomDocumentProperties
> If Item.Name = "Something to identify these by" Then
> Set thePresentation = pres
> End If
> Next
> Next
>
> If thePresentation Is Nothing Then
> ' No presentation - create new"
> newName = InputBox("New presentation name", "Please type
> the presentation name")
> 'get new name
>
> FileCopy thePath & "\Template.pot", newPath & "\" & newName
> & ".ppt"
>
> TemplateFileName = newPath & "\" & newName & ".ppt"
>
> Set thePresentation = Presentations.Open(TemplateFileName,
> msoFalse, msoTrue, msoTrue)
>
> thePresentation.CustomDocumentProperties.Add
> Name:="Something to identify these by", LinkToContent:=False,
> Type:=msoPropertyTypeBoolean, Value:=True
> thePresentation.Slides(1).Layout = ppLayoutTitleOnly
> thePresentation.Slides(1).Shapes(1).TextFrame.TextRange =
> newname
>


Depending on how you open a presentation, PPT may or may not set the current
directory to the presentation file's directory. A .Save will save to the
current direction, I'm fairly sure, so you probably need to force the issue:
instead of this:

> thePresentation.Save


try

thePresentation.SaveAs(TemplateFileName)

Or before the .Save explicitly set the current drive directory to where you
want the save to take place.

> End If
> End If
>
> SlideShowWindows(1).View.Slide.Copy
> thePresentation.Slides.Paste
> thePresentation.Save
> thiswin.Activate
>
> End Sub
>
> Any idea why the path of 'thePresentation' gets set to the 'My
> Documents' folder?
>
> Best regards
> Martin
>


-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================


 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I show current weather in a powerpoint presentation? =?Utf-8?B?QnJvdHNraQ==?= Microsoft Powerpoint 3 19th Mar 2007 01:45 PM
How do I setup Presentation to automatically show as a show? =?Utf-8?B?SmFuZXQ=?= Microsoft Powerpoint 1 22nd Feb 2006 08:35 PM
import slides to current presentation =?Utf-8?B?dHJrc3Rpcg==?= Microsoft Powerpoint 1 7th Sep 2005 10:48 PM
Reading the current Namespace.Class, Assemble at runtime Mike Walters Microsoft VB .NET 1 3rd Aug 2004 02:57 PM
Current time show in slide show? Martin Clapp Microsoft Powerpoint 1 10th Mar 2004 06:05 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:10 PM.