Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General PowerPoint Questions / June 2006

Tip: Looking for answers? Try searching our database.

Assemble presentation from current show

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Martin Stender - 07 Jun 2006 14:51 GMT
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
Steve Rindsberg - 07 Jun 2006 16:31 GMT
> Hi all
>
[quoted text clipped - 58 lines]
>             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
[quoted text clipped - 11 lines]
> Best regards
> Martin

-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ:  www.pptfaq.com
PPTools:  www.pptools.com
================================================
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.