VBA to Change Slide Name

J

John Michl

I'm using the code below to change slide names from the PPT assigned
"Slide10" to something more meaningful for the code I'm using
elsewhere. However, these names don't stick after closing the
document and reopening. I'm using PPT 07. Am I doing something
wrong? Any help would be appreciated.

Sub ChangeSlideName()

strNewName = ActiveWindow.View.Slide.Name

strNewName = InputBox("Current slide name is " &
ActiveWindow.View.Slide.Name & vbCrLf & vbCrLf & _
" Enter new name: ", "Rename Slide",
ActiveWindow.View.Slide.Name)

ActiveWindow.View.Slide.Name = strNewName

MsgBox "Slide name is now: " & ActiveWindow.View.Slide.Name


End Sub
 
D

David Marcovitz

I just tested your code in PPT 2007, and it works just fine for me.
Other than needing to correct the line breaks (which I assume was just
because of pasting into the news software). Does the name change work
before you close the presentation. Have you tried making some other
change to your slide and saving? I'm grasping at straws because your
code seems perfect to me.
--David
 
J

John Michl

Thanks, David. The code works fine for me until I save the PPT, close
and reopen. I'm saving in compatability mode so it creates a 2003
file. Apparently that's where it looses the slide names and they
revert to the PPT assigned names. I tried saving as a PPTM and that
works fine so it appears to be a bug in the conversion process. I
found a couple other references to this issue in the forums so I'm not
alone.

For this project, the company will be completed converted to Office
2007 in a month so I've created a workaround until then.

- John
 
S

Shyam Pillai

Yes, it's a bug. You might consider writing the name as a slide tag instead.
The tag travels nicely between versions.

Regards,
Shyam Pillai

Image Importer Wizard: http://skp.mvps.org/iiw.htm



Thanks, David. The code works fine for me until I save the PPT, close
and reopen. I'm saving in compatability mode so it creates a 2003
file. Apparently that's where it looses the slide names and they
revert to the PPT assigned names. I tried saving as a PPTM and that
works fine so it appears to be a bug in the conversion process. I
found a couple other references to this issue in the forums so I'm not
alone.

For this project, the company will be completed converted to Office
2007 in a month so I've created a workaround until then.

- John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top