Consulting

Results 1 to 5 of 5

Thread: Word 2016 tasks.exists() problem

  1. #1
    VBAX Newbie
    Joined
    Mar 2024
    Posts
    1
    Location

    Word 2016 tasks.exists() problem

    Hi to all, I am new here and i am loosing my mind.
    I inherited system maintenace for one client from previous system admin few months ago and we are upgrading system step by step. First step was to move emails to o365 exchange. Because of that we had to upgrade office suite on rdp to 2016 version because emails are read on server. That is another can of worms.

    We have an app on RDP server that opens word for reporting. After word document has been created app inserts some macros in it. When user is done with it, clicks on Exit (or X button) call sub that is closing active word document.
    Sub cheks if tasks.exists() and then closes open word document.
    After upgrade from Word 2013 to Word 2016 we have random not responding problems and word doc is closing long time (sometimes after 30 min). It is not always so I am puzzled.

    I try to recreate problem and i opened empty word doc, create sub and run it. Code looks like this (for testing purpose)

    Sub test()
        a = 1
        For i = 1 To 10000
        If Tasks.Exists("MMMMM") Then
        Else
            a = a + 1
        End If
        Debug.Print (a)
        Next i
    End Sub
    debug.print is here to catch on which pass it stops responding but it did not help me at all.
    Sometimes it runs several times without any problem, and sometimes it stops on first pass " If Tasks.Exists("MMMMM") Then " and i have to kill it from task manager. (word is not responding).

    I tried to disable AV but no change, all updates are up to date for Win (2016) and Office.
    Only thing I have noticed is that when it break (stop respondig and cannot search trough tasks) is that Software Protection service stops.
    Also colegue said that sometims Access app is closing for a very long time, and he said it was also happening before upgrade but rarely.
    I have hit the wall and i need fresh pair of eyes.

    Any help would be appreciated.

    p.s. app is not made in the house so i can't change the way it works.


    Br,
    GK
    Last edited by Aussiebear; 03-05-2024 at 03:51 AM. Reason: Added code tags to supplied code

  2. #2
    maybe Tasks is a collection or dictionary object on a specific word docm.

  3. #3
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,236
    Location
    Welcome to VBAX gorank99. I have always dislked logic that isn't followed. Are you sure that the code as presented is correct?


    Sub test()
        a = 1
        For i = 1 To 10000
        If Tasks.Exists("MMMMM") Then
        Else
            a = a + 1
        End If
        Debug.Print (a)
        Next i
    End Sub
    Notice that you have an IF test, followed immediately by an ELSE, followed by a result if False.
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  4. #4
    Quote Originally Posted by Aussiebear View Post
    Welcome to VBAX gorank99. I have always dislked logic that isn't followed. Are you sure that the code as presented is correct?


    Sub test()
        a = 1
        For i = 1 To 10000
        If Tasks.Exists("MMMMM") Then
        Else Tiny Fishing
            a = a + 1
        End If
        Debug.Print (a)
        Next i
    End Sub
    Notice that you have an IF test, followed immediately by an ELSE, followed by a result if False.
    I tried but it still doesn't work, can you help?...

  5. #5
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,236
    Location
    What actually have you tried?
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •