Live-Forum - Die aktuellen Beiträge
Datum
Titel
07.05.2024 16:36:49
07.05.2024 14:51:38
07.05.2024 13:27:17
Anzeige
Archiv - Navigation
1924to1928
Aktuelles Verzeichnis
Verzeichnis Index
Übersicht Verzeichnisse
Vorheriger Thread
Rückwärts Blättern
Nächster Thread
Vorwärts blättern
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
Inhaltsverzeichnis

VBA Code anpassen?

VBA Code anpassen?
22.03.2023 11:22:21
Thomas

Leider nochmal Powerpoint und VBA.

Ich habe diesen Code gefunden, der auch funktioniert.
Allerdings würde ich hier anstatt in eines Meldefensters, die Foliennummer eine nach der anderen einklimpern, sondern im Code vorgeben wollen.

Weiß jemand wie man die Zeile, vermutlich ab ""myArray(i) = InputBox("Enter the slide number, press ok to enter another")"" anpassen muss?

Private Sub CommandButton5_Click()

Dim myArray() As Integer
Dim lngSecond As Integer
Dim strPath As String
Dim ipos As Integer
Dim SlidesCount As Integer
Dim i As Integer


If ActivePresentation.Path = "" Then
MsgBox "Save me first"
Exit Sub
End If


ipos = InStrRev(ActivePresentation.FullName, ".")
strPath = Left(ActivePresentation.FullName, ipos - 1) & ".pdf"




SlidesCount = 7 'Anzahl der Seiten 
For i = 1 To SlidesCount
ReDim Preserve myArray(i)
myArray(i) = InputBox("Enter the slide number, press ok to enter another")
Next i


ActiveWindow.Panes(1).Activate
ActivePresentation.Slides.Range(myArray).Select
ActivePresentation.ExportAsFixedFormat Path:=strPath, FixedFormatType:=ppFixedFormatTypePDF, RangeType:=ppPrintSelection
End Sub


4
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
AW: VBA Code anpassen?
22.03.2023 11:27:12
Rudi Maintaire
hallo,
Private Sub CommandButton5_Click()

Dim myArray
Dim lngSecond As Integer
Dim strPath As String
Dim ipos As Integer
Dim SlidesCount As Integer
Dim i As Integer


If ActivePresentation.Path = "" Then
MsgBox "Save me first"
Exit Sub
End If


ipos = InStrRev(ActivePresentation.FullName, ".")
strPath = Left(ActivePresentation.FullName, ipos - 1) & ".pdf"

SlidesCount = 7 'Anzahl der Seiten 

myArray = Array(1,3,6,7)

ActiveWindow.Panes(1).Activate
ActivePresentation.Slides.Range(myArray).Select
ActivePresentation.ExportAsFixedFormat Path:=strPath, FixedFormatType:=ppFixedFormatTypePDF, RangeType:=ppPrintSelection
End Sub
Gruß
Rudi


Anzeige
AW: VBA Code anpassen?
22.03.2023 15:00:49
Thomas
Hallo Rudi,

Mega geil.
Es klappt, könnte ich im Code irgendwie noch den Speichernamen festlegen?

Danke schön.


AW: VBA Code anpassen?
22.03.2023 23:03:03
Yal
Hallo Thomas,

vielleicht so:
Private Sub CommandButton5_Click()
Dim strPath As String

    With ActivePresentation
        If .Path = "" Then
            MsgBox "Save me first"
            Exit Sub
        End If
        strPath = Left(.FullName, InStrRev(.FullName, ".") - 1) & ".pdf"
        strPath = InputBox("Speichern als (PDF):", , strPath)
        ActiveWindow.Panes(1).Activate
        .Slides.Range(Array(1, 3, 6, 7)).Select
        .ExportAsFixedFormat Path:=strPath, FixedFormatType:=ppFixedFormatTypePDF, RangeType:=ppPrintSelection
    End With
End Sub
VG
Yal


Anzeige
AW: VBA Code anpassen?
23.03.2023 08:37:07
Thomas
Prima. Klappt, Danke schön für Eure Hilfe

Links zu Excel-Dialogen

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige