I'm trying to check and set over 300 MS Word documents. I'm using MS Access VBA to go to the folder, open each file check the setting, set if necessary and then close the file. I did something similar before in in Access so I hope I can do this too.
In Word, I go File->Options->Add-ins-> Manage Templates [Go...] to get to this dialog box:
templateaddin.jpg
I am able to get Document template using doc.AttachedTemplate.FullName (doc represents the word file. you can see my code below)
however, i'm trying to get the checkbox "Automatically update document styles" Does anyone know what the variable/property name is for that field?
Here's my code so far.
Private Sub ListFiles(mysourcePath As String, extension As String)
Set MyObject = New Scripting.filesystemobject
Set MySource = MyObject.getfolder(mysourcePath)
On Error GoTo errhandler ' Resume Next
For Each Myfile In MySource.Files
MyFilename = Trim(Myfile.Name)
If InStr(1, MyFilename, "~") = 0 Then
' temp character not found
If InStr(1, MyFilename, "." & extension) Then
Call ProcessWordFile(MyFilename)
End If
End If
Next
exit sub
Private Sub ProcessWordFile(Filename As String)
On Error GoTo ErrorHandling
Dim appWord As Word.Application
Dim doc As Word.Document
Dim strDocName As String
Dim TemplateName As String
Dim LinkedStyles As String
Dim MyStyle As Style
strDocName = MI_Path & "" & Filename
' Open the word file
Set appWord = GetObject(, "Word.Application")
Set doc = appWord.Documents.Open(strDocName, , True)
TemplateName = doc.AttachedTemplate.FullName
' CheckboxValue =
' How do I get that checkbox here???
doc.Close ' Close the Word File
end sub
Again, my main objective is trying to get the property name for "Automatically update document styles". From there i can determine what I have to do next.
THanks.