![]() |
|
#1
|
|||
|
|||
|
I have a powerpoint file where I want to save each of the individual slides as jpgs. That bit is fine. The issue is I want the file names to be the text on the individual slide. So if a slide has the text 'Hello There' I want the slide to save as hello-there.jpg (all in lower case, up to 25 characters). Is there any way to do this? Is there any sample VBA script that anyone is aware of that does something similar so I'm not starting from scratch. I'm pretty new to this but willing to give it a go. Know a little VBA. Thanks in advance.
|
|
#2
|
|||
|
|||
|
This might give you a start (assumes you are looking at Title text)
Code:
Sub exporter()
Dim osld As Slide
Dim strFolder As String
Dim strName As String
On Error Resume Next
strFolder = Environ("USERPROFILE") & "\Desktop\Slides\"
MkDir strFolder
For Each osld In ActivePresentation.Slides
If osld.Shapes.HasTitle Then
If osld.Shapes.Title.TextFrame2.HasText Then
strName = osld.Shapes.Title.TextFrame2.TextRange
strName = Replace(strName, " ", "-")
Else
strName = "Slide_" & CStr(osld.SlideIndex)
End If
Else
strName = "Slide_" & CStr(osld.SlideIndex)
End If
Call osld.Export(strFolder & strName & ".jpg", "JPG")
Next osld
End Sub
Last edited by JohnWilson; 04-25-2018 at 07:00 AM. |
|
#3
|
|||
|
|||
|
Thank you very much for such a prompt response. This is brilliant; gives me a really good starting point. Thanks again.
|
|
#4
|
|||
|
|||
|
Can you go back to your cross post and note that you have a solution elsewhere. Otherwise someone may be wasting time on it right now.
http://www.vbaexpress.com/forum/show...e-as-file-name |
|
| Tags |
| jpg, save text, text |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Editable text box in master slide not appearing once closing master slide mode | tparnicott | PowerPoint | 1 | 06-17-2016 04:13 AM |
Lyric slide show - using a variable to pull text from next slide
|
elfman12 | PowerPoint | 3 | 03-08-2013 12:27 AM |
Text typed on slide x ports to slide y automatically?
|
Thinker | PowerPoint | 5 | 07-26-2012 11:59 PM |
slide image wont copy with text to new slide
|
lewis.mulhollen | PowerPoint | 1 | 12-17-2011 03:17 AM |
| PP 2010 .avi file plays during slide show, but causes the slide show to loop to begin | VictorS | PowerPoint | 0 | 10-16-2010 10:23 AM |