M
Martin Stender
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
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