Martin_H
Board Regular
- Joined
- Aug 26, 2020
- Messages
- 190
- Office Version
- 365
- Platform
- Windows
Hi,
I am using a macro (see below) to update multiple charts in multiple PowerPoint files (macro is stored in .xlm file).
The macro is calling multiple functions (SV1, SV2, SV3, SV4, SV5, SV6).
Each function is dedicated to update specific PowerPoint file.
The question is: Do I need 6 separated functions to update 6 different PowerPoint files (6 different location addresses)?
Is it possible to - somehow - combine these 6 functions into one?
Thank you.
I am using a macro (see below) to update multiple charts in multiple PowerPoint files (macro is stored in .xlm file).
The macro is calling multiple functions (SV1, SV2, SV3, SV4, SV5, SV6).
Each function is dedicated to update specific PowerPoint file.
The question is: Do I need 6 separated functions to update 6 different PowerPoint files (6 different location addresses)?
Is it possible to - somehow - combine these 6 functions into one?
Thank you.
VBA Code:
Sub Update_PPTX
'Main code
With Application
.ScreenUpdating = False
Call SV1
Call SV2
Call SV3
Call SV4
Call SV5
Call SV6
.ScreenUpdating = True
End With
End Sub
VBA Code:
Function SV1()
Set PPT = CreateObject("PowerPoint.Application")
PTT.Visible = True
PTT.Presentations.Open "address1", Untitled:=msoTrue
PTT.ActivePresentation.UpdateLinks
PTT.ActivePresentation.SaveAs Filename:="address1"
PTT.Quit
Set PPT = Nothing
End Function
Function SV2()
Set PPT = CreateObject("PowerPoint.Application")
PTT.Visible = True
PTT.Presentations.Open "address2", Untitled:=msoTrue
PTT.ActivePresentation.UpdateLinks
PTT.ActivePresentation.SaveAs Filename:="address2"
PTT.Quit
Set PPT = Nothing
End Function
Function SV3()
Set PPT = CreateObject("PowerPoint.Application")
PTT.Visible = True
PTT.Presentations.Open "address3", Untitled:=msoTrue
PTT.ActivePresentation.UpdateLinks
PTT.ActivePresentation.SaveAs Filename:="address3"
PTT.Quit
Set PPT = Nothing
End Function
Function SV4()
Set PPT = CreateObject("PowerPoint.Application")
PTT.Visible = True
PTT.Presentations.Open "address4", Untitled:=msoTrue
PTT.ActivePresentation.UpdateLinks
PTT.ActivePresentation.SaveAs Filename:="address4"
PTT.Quit
Set PPT = Nothing
End Function
Function SV5()
Set PPT = CreateObject("PowerPoint.Application")
PTT.Visible = True
PTT.Presentations.Open "address5", Untitled:=msoTrue
PTT.ActivePresentation.UpdateLinks
PTT.ActivePresentation.SaveAs Filename:="address5"
PTT.Quit
Set PPT = Nothing
End Function
Function SV6()
Set PPT = CreateObject("PowerPoint.Application")
PTT.Visible = True
PTT.Presentations.Open "address6", Untitled:=msoTrue
PTT.ActivePresentation.UpdateLinks
PTT.ActivePresentation.SaveAs Filename:="address6"
PTT.Quit
Set PPT = Nothing
End Function