#1
|
|||
|
|||
HI,
I have hundred's of pptx files along with excel files in a folder. I want to convert all selected pptx files into individual hd videos(in mp4 format) and save into another folder by using vba. pls help. Note: iam using office 2016. i wrote a code for this. but few lines of code is not working properly (code colored with blue) pls go through the below code and help me. Code:
Option Explicit Sub GetFolderPath() Dim InputFolder As String Dim OutputFolder As String Dim fd1, fd2 As FileDialog Dim cpath, dpath As String Dim FileInFromFolder As Object Dim fil As Scripting.File Dim cfolder, dfolder As Scripting.Folder '----------------------------------------------------------------------------------------- Dim fso As Scripting.filesystemobject Dim actionclicked As Boolean Set fso = New Scripting.filesystemobject Set fd1 = Application.FileDialog(msoFileDialogFolderPicker) Set fd2 = Application.FileDialog(msoFileDialogFolderPicker) fd1.Title = "pick the folder to save files into" fd1.AllowMultiSelect = False actionclicked = fd1.Show If actionclicked Then InputFolder = fd1.SelectedItems(1) Else MsgBox "You didn't pick a folder" Exit Sub End If If InputFolder = "" Then MsgBox "Select a folder then click Yes" Exit Sub End If cpath = InputFolder Set fso = New Scripting.filesystemobject Set cfolder = fso.GetFolder(cpath) cpath = Replace(cpath, "\\", "\") Debug.Print cfolder Set fd2 = Application.FileDialog(msoFileDialogFolderPicker) fd2.Title = "pick the folder to save files into" fd2.AllowMultiSelect = False actionclicked = fd2.Show If actionclicked Then OutputFolder = fd2.SelectedItems(1) Else MsgBox "You didn't pick a folder" Exit Sub End If If OutputFolder = "" Then MsgBox "Select a folder then click Yes" Exit Sub End If dpath = OutputFolder Set fso = New Scripting.filesystemobject Set dfolder = fso.GetFolder(dpath) dpath = Replace(dpath, "\\", "\") 'Debug.Print dfolder For Each fil In cfolder.Files If Left(fso.GetExtensionName(fil.Path), 2) = "pp" And Format(fil.DateLastModified, "dd/mm/yyyy") = Format(Date, "dd/mm/yyyy") Then Application.ActivePresentation.SaveAs _ FileName:=dpath & "\" & fil.Name & ".mp4", _ FileFormat:=ppSaveAsMP4 End If Next End Sub |
#2
|
||||
|
||||
Cross-posted at: http://www.vbaexpress.com/forum/show...thod-using-vba
For cross-posting etiquette, please read: http://www.excelguru.ca/content.php?184 I note also this is the fourth thread you have started here on this topic. Kindly don't do that. I've merged two and deleted the other two.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Convert PPTX to MP4 | Robin Chapple | PowerPoint | 3 | 03-18-2015 02:46 PM |
The powerpoint icon on the task bar hides pptx files in the recent files list | Innovationgame | PowerPoint | 0 | 11-13-2013 09:03 AM |
How can I convert pptx to text format like Word, and later on create pptx too? | GetLost | PowerPoint | 0 | 01-11-2012 04:23 AM |
convert multiple csv files to multiple excel files | mit | Excel | 1 | 06-14-2011 10:15 AM |
Bulk convert Powerpoint XML files to PPT or PPTX | RileyT | PowerPoint | 0 | 11-21-2010 04:16 PM |