Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-11-2021, 12:10 PM
Blondyvl Blondyvl is offline Modify all Tables in a Folder Windows 10 Modify all Tables in a Folder Office 2010
Novice
Modify all Tables in a Folder
 
Join Date: Oct 2020
Posts: 7
Blondyvl is on a distinguished road
Default Modify all Tables in a Folder

Is it possible to make a macro that goes through all of the word files in a folder and set all tables in each of the word documents to ‘allow row to break across pages’ ?

Many thanks
Reply With Quote
  #2  
Old 06-11-2021, 03:29 PM
macropod's Avatar
macropod macropod is offline Modify all Tables in a Folder Windows 10 Modify all Tables in a Folder Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

For example:
Code:
Sub UpdateDocuments()
Application.ScreenUpdating = False
Dim strDocNm As String, strFolder As String, strFile As String
Dim wdDoc As Document, wdTbl As Table
strFolder = GetFolder
If strFolder = "" Then Exit Sub
strFile = Dir(strFolder & "\*.doc", vbNormal)
strDocNm = ThisDocument.FullName
While strFile <> ""
  If strFolder & "\" & strFile <> strDocNm Then
    Set wdDoc = Documents.Open(FileName:=strFolder & "\" & strFile, AddToRecentFiles:=False, Visible:=False)
    With wdDoc
      For Each wdTbl In .Tables
        wdTbl.Rows.AllowBreakAcrossPages = True
      Next
      .Close SaveChanges:=True
    End With
  End If
  strFile = Dir()
Wend
Set wdDoc = Nothing
Application.ScreenUpdating = True
End Sub
 
Function GetFolder() As String
Dim oFolder As Object
GetFolder = ""
Set oFolder = CreateObject("Shell.Application").BrowseForFolder(0, "Choose a folder", 0)
If (Not oFolder Is Nothing) Then GetFolder = oFolder.Items.Item.Path
Set oFolder = Nothing
End Function
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Create rule to move email from archive folder to senders name folder bigduke70 Outlook 0 03-09-2019 08:33 AM
Hilight Parent Folder when Child folder is allocated a new email brucemc777 Outlook 2 11-09-2016 09:14 AM
I have an example but I can't modify it as I want! kareemva Excel Programming 0 02-27-2016 11:48 PM
Modify all Tables in a Folder How to modify and/or delete TOC Nathan8752 Word 10 11-13-2015 01:20 PM
How to constantly and automatically copy the contacts from a shared folder to my private folder? Paulo Outlook 0 08-16-2015 12:06 PM

Other Forums: Access Forums

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


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