View Single Post
 
Old 04-24-2017, 04:53 AM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Your attached template contains over 1000 lines of code. That's a lot to ask anyone to analyse, looking for problems. Some of it seems unnecessarily convoluted, too. For example, you could probably replace the calls to getNameOnly, which invokes:
Code:
Function getCurName() As String
    getCurName = LCase(ActiveDocument.name)
End Function

Function getNameOnly() As String
    Dim testString As String
    Dim lastIndex As Integer
    lastIndex = InStrRev(getCurName(), ".") - 1
    testString = Mid(getCurName(), lastIndex, Len(getCurName()) - lastIndex)
    getNameOnly = Mid(getCurName(), 1, lastIndex)
End Function
with:
Code:
LCase(Split(ActiveDocument.Name, ".doc")(0))
You could most certainly replace statements like:
Code:
ActiveDocument.path + "\" + ActiveDocument.name
with:
Code:
ActiveDocument.FullName
Usually, if the execution behaviour changes, it's because someone has changed the code or done something to the data structures (e.g. file/folder names) that invalidates the assumptions upon which the code works. I suggest you review whatever changes might have been made in those respects.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote