Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Remove attributes from Word .doc files in a batch

Posted on 2010-09-22
4
Medium Priority
?
568 Views
Last Modified: 2012-05-10
Hi,

is there a way to remove attributes from a batch of word/excel docs ? I have documents and spreadsheets that have be moved on a server that are trying to reference and old workstation for the template every time you open them which is causing delays in opening.

If I open the document in word/excel 2010 and use the document inspector it finds the attributes which are document properties and personal information. When I remove these attributes the problem is resolved. The issue I have is that I have thousands of documents.

Any Ideas?
0
Comment
Question by:gilliganwedge2
  • 2
4 Comments
 
LVL 11

Expert Comment

by:ProfessorBindokas
ID: 33732707
Hi

There is a shareware tool that allows batch processing of properties on word files that worked pretty well for me - http://www.freedownloadscenter.com/Business/MS_Office_Add-ins/MS_Word_Document_File_Properties_Changer.html

Perhaps you will find this useful, too.
0
 
LVL 9

Expert Comment

by:rfportilla
ID: 33732724
This requires a script of some kind.  THe basic construct is this:

1. unzip the *.docx file
2. Either load contents into an xml object of some kind (depends on language) or search and replace text
3. zip again

docx and xlsx files are really just zipped xml files.  Once you unzip them you can work with just like xml.  There may be a tool for this online, but I don't know of one personally.  
0
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 2000 total points
ID: 33733549
This question has been asked a number of times in this forum.
The macro below is taken from this one:

http://www.experts-exchange.com/Software/Office_Productivity/Office_Suites/MS_Office/Word/Q_24131218.html


It does a recursive search for all documents in a folder and its subfolders.

It needs to be called thus:

FindFiles "C:\MYFolder", *.doc*
Sub FindFiles(strFolder As String, strFilePattern As String)
    Dim strFileName As String
    Dim strFolders() As String
    Dim iFolderCount As Integer
    Dim i As Integer
    Dim wdDoc As Word.Document
   
    'collect child folders
    strFileName = Dir$(strFolder & "\", vbDirectory)
    Do Until strFileName = ""
        If (GetAttr(strFolder & "\" & strFileName) And vbDirectory) = vbDirectory Then
            If Left$(strFileName, 1) <> "." Then
                ReDim Preserve strFolders(iFolderCount)
                strFolders(iFolderCount) = strFolder & "\" & strFileName
                iFolderCount = iFolderCount + 1
            End If
        End If
        strFileName = Dir$()
    Loop
   
    'process files in current folder
    strFileName = Dir$(strFolder & "\" & strFilePattern)
    Do Until strFileName = ""
            DoEvents
            Set wdDoc = Documents.Open(strFolder & "\" & strFileName)
            If wdDoc.AttachedTemplate.Path = "\\Oldserver\templates\" Then
                wdDoc.AttachedTemplate = "\\NewServer\templates\" & wdDoc.AttachedTemplate.Name
                wdDoc.Close wdSaveChanges
            Else
                wdDoc.Close wdDoNotSaveChanges
            End If
        strFileName = Dir$()
    Loop
   
    'look through child folders
    For i = 0 To iFolderCount - 1
        FindFiles strFolders(i), strFilePattern
    Next i
End Sub

Open in new window

0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 33733561
Oops. missed the quotes around *.doc*.

It should be:

FindFiles "C:\MYFolder", "*.doc*"
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Office 365 is currently available in five editions. Three of them are for business use: Office 365 Business Essentials, Office 365 Business, and Office 365 Business Premium. Two of them are for home/personal use: Office 365 Home and Office 365 Perso…
In a previous video Micro Tutorial here at Experts Exchange (http://www.experts-exchange.com/videos/1358/How-to-get-a-free-trial-of-Office-365-with-the-Office-2016-desktop-applications.html), I explained how to get a free, one-month trial of Office …

783 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question