![]() |
|
#1
|
|||
|
|||
|
I am trying to run a similar macro to https://www.msofficeforums.com/word-...ocx-files.html (actually, a much simplified version of it), but to no avail. My idea is to run a macro I have (foot2inline) on a number of files, but I am somehow failing at that. I have done this: Code:
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
Call foot2inline
.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
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
How to open Documents folder directly from CTRL+O of Open folder on QAT
|
scvjudy | Word | 2 | 08-11-2014 10:58 PM |
Content of all documents in folder changes to match one of them
|
jemmac2525 | Word | 2 | 11-11-2013 12:32 AM |
| Office 2010 Can't Open Or Save Documents in My Documents Folder | trippb | Office | 1 | 07-12-2013 07:29 AM |
Documents saved to wrong folder
|
stevecarr | Word | 1 | 09-22-2011 05:32 AM |
| Loop through folder of workbooks and copy range to other workbook | Snvlsfoal | Excel Programming | 3 | 07-29-2011 05:55 AM |