Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 08-08-2017, 10:46 AM
IneedHelpWithWord IneedHelpWithWord is offline Word 2016 Multi-file Macro issues Windows 10 Word 2016 Multi-file Macro issues Office 2016
Novice
Word 2016 Multi-file Macro issues
 
Join Date: Aug 2017
Posts: 1
IneedHelpWithWord is on a distinguished road
Exclamation Word 2016 Multi-file Macro issues

I need to un-check 'prefered width' on table properties in hundreds of documents in the same folder. I'm a novice at Macros but made one I will share, It does not work and I need help finding out why. Any feedback is greatly appreciated.



Sub UpdateDocuments()
Application.ScreenUpdating = False
Dim strFolder As String, strFile As String, wdDoc As Document
strFolder = GetFolder
If strFolder = "" Then Exit Sub
strFile = Dir(strFolder & "\*.docx", vbNormal)
While strFile <> ""
Set wdDoc = Documents.Open(FileName:=strFolder & "\" & strFile, AddToRecentFiles:=False, Visible:=False)
With wdDoc
Dim pT As Word.Table
For Each pT In ActiveDocument.Tables
pT.PreferredWidth = Unchecked
Next

.Close SaveChanges:=True
End With
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

Any amendments would be greatly appreciated.

Thank you.
Reply With Quote
 

Tags
macro, macro error, macro help



Similar Threads
Thread Thread Starter Forum Replies Last Post
Issues Using Power Query file in Excel 2016 and then in 2013 bld9936 Excel Programming 0 02-27-2017 12:50 PM
Word 2016 Multi-file Macro issues Word 2016 vs Word 2003 (issues I can't figure out) AdventureCapitliast Word 6 02-23-2017 06:23 AM
Multi page transfer of jpeg to word in OneNote 2016 MikeEsq OneNote 0 12-25-2016 09:49 AM
Document layout issues between Mac and Windows Word 2016 tlj Word 2 12-16-2016 06:51 PM
Word 2016 Multi-file Macro issues Word insert only 1st page of multi-paged PDF file Evgeniy Word 1 02-04-2012 01:36 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:16 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