C
charlie.planetxsolutions
i'm working with the following piece of code that is supposed to go through
all open word documents and close those that do not have a specific title
property. this code has worked in the past but now has stopped functioning.
For iWNum = 1 To iMAX_ARRAY_SIZE
If iWNum > WordBasic.CountWindows() Then
GoTo EndofSub
End If
' Activate window and get keyword property setting
WordBasic.WindowList iWNum
sKeyWord$ = WordBasic.[GetDocumentProperty$]("Keywords")
' If not the template, create document or missing provision window
If sKeyWord$ <> sTemplateFilePropertyTitle$ Then
If sKeyWord$ <> sCreateDocumentFilePropertyTitle$ Then
If sKeyWord$ <> sMissingProvisionsFilePropertyTitle$ Then
If sKeyWord$ <> sNonCheckingCopy$ Then
WordBasic.DocClose 2 'close window, do not save
iWNum = iWNum - 1 'decrement window count
End If
End If
End If
End If
Next iWNum
personally, its not a very nice way to do things and the best implementation
is probably to use 'for each doc in documents' which i have tested and works
great.
what happens with this code is that when keeping track of the document via
windowlist then the document windows change subscript.
my question is, was there a recent change in how windows treats
'WordBasic.WindowList iWNum' that would account for this apparent change in
behavior? is it purely luck that this code has worked in the past?
any information would be greatly appreciated.
all open word documents and close those that do not have a specific title
property. this code has worked in the past but now has stopped functioning.
For iWNum = 1 To iMAX_ARRAY_SIZE
If iWNum > WordBasic.CountWindows() Then
GoTo EndofSub
End If
' Activate window and get keyword property setting
WordBasic.WindowList iWNum
sKeyWord$ = WordBasic.[GetDocumentProperty$]("Keywords")
' If not the template, create document or missing provision window
If sKeyWord$ <> sTemplateFilePropertyTitle$ Then
If sKeyWord$ <> sCreateDocumentFilePropertyTitle$ Then
If sKeyWord$ <> sMissingProvisionsFilePropertyTitle$ Then
If sKeyWord$ <> sNonCheckingCopy$ Then
WordBasic.DocClose 2 'close window, do not save
iWNum = iWNum - 1 'decrement window count
End If
End If
End If
End If
Next iWNum
personally, its not a very nice way to do things and the best implementation
is probably to use 'for each doc in documents' which i have tested and works
great.
what happens with this code is that when keeping track of the document via
windowlist then the document windows change subscript.
my question is, was there a recent change in how windows treats
'WordBasic.WindowList iWNum' that would account for this apparent change in
behavior? is it purely luck that this code has worked in the past?
any information would be greatly appreciated.