Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 07-27-2019, 05:20 PM
Guessed's Avatar
Guessed Guessed is offline Resize Paper for Multiple Files Windows 10 Resize Paper for Multiple Files Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,176
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Try the following macro
Code:
Sub BatchPageSizer()
  Dim sPath As String, aSect As Section, aDoc As Document, iCounter As Integer
  Dim oFSO As Object, oFolder As Object, oFile As Object
  
  sPath = SelectFolder("Select folder for page sizing")
  Set oFSO = CreateObject("Scripting.FileSystemObject")
  Set oFolder = oFSO.GetFolder(sPath)
  
  For Each oFile In oFolder.files
    If Left(oFile.Type, 14) = "Microsoft Word" And Left(oFile.Name, 1) <> "~" Then
      Set aDoc = Documents.Open(FileName:=oFile.Path, Visible:=True, AddToRecentFiles:=False)
      iCounter = iCounter + 1
      For Each aSect In aDoc.Sections
        aSect.PageSetup.PageWidth = InchesToPoints(15)
        aSect.PageSetup.PageHeight = InchesToPoints(8.5)
      Next aSect
      aDoc.Close SaveChanges:=True
    End If
  Next
  MsgBox "Docs processed: " & iCounter, vbOKOnly, "Macro Finished"
End Sub

'===========================================================
Function SelectFolder(Optional sTitle As String = "Select a Folder") As String
  Dim diaFolder As FileDialog
  ' Open the file dialog
  Set diaFolder = Application.FileDialog(msoFileDialogFolderPicker)
  With diaFolder
    .AllowMultiSelect = False
    .Title = sTitle
    .Show
    SelectFolder = .SelectedItems(1)
  End With
  Set diaFolder = Nothing
End Function
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Resize Paper for Multiple Files can't draw a line in table that is continuing on multiple paper sheets katka Word Tables 1 01-24-2015 12:09 AM
Resize Paper for Multiple Files Resize multiple PowerPoint objects in a table at the same time Duradel Word Tables 3 11-16-2014 04:01 PM
Resize Paper for Multiple Files Resize multiple pictures in a Word 2010 table JBA479 Word VBA 1 01-24-2014 08:51 PM
Resize Paper for Multiple Files convert multiple csv files to multiple excel files mit Excel 1 06-14-2011 10:15 AM
Resize Paper for Multiple Files Resize video across multiple slides joelas PowerPoint 3 09-28-2010 07:59 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:07 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft