Hi all!
This is my first post in this forum and I was hoping that you could help me with a problem that I am having.
I have to save about 200 powerpoint files (.ppt) as jpg and I figured i could write a macro for this. So the solution I have come up with is this.
An excel sheet with all the filenames and path. My macro loops through the filenames, opens the files in powerpoint and then saves them as jpg. I have managed to do everything except för the saving part. I have written the following code:
Sub LoopSelection()
Worksheets("Sheet1").Select
c = ActiveWindow.RangeSelection.Address
Dim ppt As Object
Dim varde As String
Dim dir As String
Dim filename As String
Set ppt = CreateObject("PowerPoint.Application")
ppt.Visible = True
dir = Worksheets("Sheet1").Range("A1").Value
For Each r In Worksheets("Sheet1").Range(c).Cells
filename = dir + r.Value
ppt.Presentations.Open (filename)
ppt.Presentation.SaveAs "001", ppSaveAsJPG
ppt.Presentation.Close
Next r
End Sub
And when i run the program I manage to start powerpoint with the specified file but it is unable to call the SaveAs subroutine. I get error number 438. I don't have a clue how to solve this problem and look forward to your suggestions.
Cheers
zolero
This is my first post in this forum and I was hoping that you could help me with a problem that I am having.
I have to save about 200 powerpoint files (.ppt) as jpg and I figured i could write a macro for this. So the solution I have come up with is this.
An excel sheet with all the filenames and path. My macro loops through the filenames, opens the files in powerpoint and then saves them as jpg. I have managed to do everything except för the saving part. I have written the following code:
Sub LoopSelection()
Worksheets("Sheet1").Select
c = ActiveWindow.RangeSelection.Address
Dim ppt As Object
Dim varde As String
Dim dir As String
Dim filename As String
Set ppt = CreateObject("PowerPoint.Application")
ppt.Visible = True
dir = Worksheets("Sheet1").Range("A1").Value
For Each r In Worksheets("Sheet1").Range(c).Cells
filename = dir + r.Value
ppt.Presentations.Open (filename)
ppt.Presentation.SaveAs "001", ppSaveAsJPG
ppt.Presentation.Close
Next r
End Sub
And when i run the program I manage to start powerpoint with the specified file but it is unable to call the SaveAs subroutine. I get error number 438. I don't have a clue how to solve this problem and look forward to your suggestions.
Cheers
zolero