J
jocker
I have several hundred documents received from other offices and am
attempting to list the templates which are not "normal.dot". The attached
VBA lists both normal and non-normal however. Can some kind soul help.
Sub not_normal_search()
Dim i As Long, currentDoc As Document, listingdoc As Document, z As Long
Dim docname As String, docpath As String, currentRange As Range
Documents.Add
Set listingdoc = ActiveDocument
With ActiveDocument.PageSetup
.LeftMargin = CentimetersToPoints(1.6)
.RightMargin = CentimetersToPoints(1.6)
End With
With Application.FileSearch
.NewSearch
.LookIn = "G:\a_cv_test_new\"
.FileType = msoFileTypeWordDocuments
If .Execute() > 0 Then
For i = 1 To .FoundFiles.Count
Documents.Open FileName:=.FoundFiles(i)
Set currentDoc = ActiveDocument
Set mytemplate = ActiveDocument.AttachedTemplate
listingdoc.Activate
'''''''''''
If Dialogs(wdDialogToolsTemplates).Template <> "normal" Then _
Selection.TypeText Dialogs(wdDialogToolsTemplates).Template & vbCr Else GoTo
q
MsgBox Dialogs(wdDialogToolsTemplates).Template
q:
currentDoc.Close wdDoNotSaveChanges
Next i
End If
End With
ScreenUpdating = True
AnimateScreenMovements = False
Application.Visible = True
ChangeFileOpenDirectory "G:\a_CV_test\"
ActiveDocument.SaveAs FileName:="no details.doc"
Documents.Open FileName:="no details.doc"
End Sub
attempting to list the templates which are not "normal.dot". The attached
VBA lists both normal and non-normal however. Can some kind soul help.
Sub not_normal_search()
Dim i As Long, currentDoc As Document, listingdoc As Document, z As Long
Dim docname As String, docpath As String, currentRange As Range
Documents.Add
Set listingdoc = ActiveDocument
With ActiveDocument.PageSetup
.LeftMargin = CentimetersToPoints(1.6)
.RightMargin = CentimetersToPoints(1.6)
End With
With Application.FileSearch
.NewSearch
.LookIn = "G:\a_cv_test_new\"
.FileType = msoFileTypeWordDocuments
If .Execute() > 0 Then
For i = 1 To .FoundFiles.Count
Documents.Open FileName:=.FoundFiles(i)
Set currentDoc = ActiveDocument
Set mytemplate = ActiveDocument.AttachedTemplate
listingdoc.Activate
'''''''''''
If Dialogs(wdDialogToolsTemplates).Template <> "normal" Then _
Selection.TypeText Dialogs(wdDialogToolsTemplates).Template & vbCr Else GoTo
q
MsgBox Dialogs(wdDialogToolsTemplates).Template
q:
currentDoc.Close wdDoNotSaveChanges
Next i
End If
End With
ScreenUpdating = True
AnimateScreenMovements = False
Application.Visible = True
ChangeFileOpenDirectory "G:\a_CV_test\"
ActiveDocument.SaveAs FileName:="no details.doc"
Documents.Open FileName:="no details.doc"
End Sub