1 year ago

#74421

test-img

Miguel de las Nieves

Save current slide, no fonts

This is a piece of code I wrote to save the current slide with no embedded fonts into a single

I think something with the path is wrong because it seems to mix-up a Onedrive path with the rest of the path and filename I add. And though it confirms the file has been saved, I can't find it.

Thanks in advance for your help!

    Option Explicit
    
    Sub SaveCurrentSlide()
    
    Dim CurrentSlide As String
    Dim tPath As String
    Dim tFilename As String
    
    CurrentSlide = ActiveWindow.View.Slide.SlideIndex
    On Error GoTo errorhandler

    If ActiveWindow.ViewType = ppViewNormal Then ActiveWindow.Panes(1).Activate

    With ActivePresentation
        ' Build a unique filename and save a coy of the now single-slide presentation
        tPath = .Path
        tFilename = tPath & "\" & Left(.Name, InStrRev(.Name, ".") - 1) & " [slide " & CurrentSlide & "].pptx"
        ActivePresentation.SaveAs FileName:=tFilename, _
        FileFormat:=ppSaveAsPresentation, EmbedTrueTypeFonts:=msoFalse
    End With
    
    ' Give feedback to the user
    MsgBox "Current slide exported to:" & vbNewLine & tFilename, vbOKOnly, "Export Current Slide - Export Complete"
    
    On Error GoTo 0
    Exit Sub

errorhandler:
          Debug.Print Err, Err.Description
          Resume Next
          End Sub

vba

filesystems

powerpoint

0 Answers

Your Answer

Accepted video resources